Dear Friends
I had try to implemented Listviewpanel item from this link
https://wisej.com/support/question/listviewpanelitem-and-listview-add-function
I had some trouble when implement it, i hope someone will share some knowledge, where is wrong.
Thanks
Nicky
This my code
This procedure to crete Tabpage and Listview base on table category
Sub PAppearCategory()
Dim srdr As SqlDataReader, intid As Int64, strnm As String
scon = POS1.F_con()
If TCtrl.TabCount > 1 Then
For intb = 0 To TCtrl.TabCount – 1
TCtrl.TabPages.RemoveAt(intb)
Next
End If
Dim tp As New TabPage, LV As New ListView
LV.Dock = Wisej.Web.DockStyle.Fill
LV.Name = “lv0”
LV.LabelWrap = True
LV.ShowItemToolTips = True
LV.ItemSize = New System.Drawing.Size(120, 160)
AddHandler LV.ItemDoubleClick, AddressOf LV_ItemDoubleClick
tp.Controls.Add(LV)
tp.Name = “tp0”
tp.Text = “ALL”
TCtrl.Controls.Add(tp)
Try
scon.Open()
strsql = “select [id],nama from m_produk_kategori order by nama”
scom = New SqlCommand(strsql, scon)
srdr = scom.ExecuteReader()
While srdr.Read()
intid = IIf(IsDBNull(srdr.Item(“id”)) = True, 0, srdr.Item(“id”))
strnm = IIf(IsDBNull(srdr.Item(“nama”)) = True, “”, srdr.Item(“nama”))
Dim tp1 As New TabPage, LV1 As New ListView
LV1.Dock = Wisej.Web.DockStyle.Fill
LV1.Name = “lv” & intid
LV1.LabelWrap = True
LV1.ShowItemToolTips = True
LV1.ItemSize = New System.Drawing.Size(120, 160)
AddHandler LV1.ItemDoubleClick, AddressOf LV_ItemDoubleClick
tp1.Controls.Add(LV1)
tp1.Name = “tp” & intid
tp1.Text = strnm.ToUpper
TCtrl.Controls.Add(tp1)
End While
srdr.Close()
Catch ex As Exception
AlertBox.Show(ex.Message)
End Try
scon.Close()
scon.Dispose()
End Sub
This code to show listviewitem using control (i had made another windows to set listviewitem)
Sub PAppearProduct(ByVal strkat As String)
Dim srdr As SqlDataReader, strnm, strprod, strgr As String
If TCtrl.TabPages(strkat).Controls.Count > 0 Then
For inxno = 0 To TCtrl.TabPages(strkat).Controls.Count – 1
Dim controlx As Object = TCtrl.TabPages(strkat).Controls(inxno)
Dim strkatid As String = controlx.name
strkatid = strkatid.Replace(“lv”, “”)
If IsNumeric(strkatid) Then
controlx.Items.Clear()
scon = POS1.F_con()
Try
scon.Open()
If strkatid = 0 Then
strsql = “select code,nama,gbr_icon_inv from m_produk where [status]=1 order by nama”
Else
strsql = “select code,nama,gbr_icon_inv from m_produk where cd_kategori=” & strkatid & ” and [status]=1 order by nama”
End If
scom = New SqlCommand(strsql, scon)
srdr = scom.ExecuteReader()
While srdr.Read()
strprod = IIf(IsDBNull(srdr.Item(“code”)) = True, “”, srdr.Item(“code”))
strnm = IIf(IsDBNull(srdr.Item(“nama”)) = True, “”, srdr.Item(“nama”))
strgr = IIf(IsDBNull(srdr.Item(“gbr_icon_inv”)) = True, “”, srdr.Item(“gbr_icon_inv”))
Dim lvi As New ListViewItem
lvi.ToolTipText = strnm
lvi.Name = strprodDim itm = New WindInvLI
itm.lblKet.Text = strnm
If strgr.Trim <> “” Then
itm.PBoximg.BackgroundImageSource = ConfigurationManager.AppSettings(“program.uploadprodukfolder”) & strgr
End If
itm.lblharga.Text = “$ 50.000”
itm.lbljumlah.Text = “10 pcs”
itm.Dock = DockStyle.Fill
lvi.Control = itm
lvi.Control.Show() ‘===>{item didn’t show when this line we deleted}
controlx.items.add(lvi)
End While
srdr.Close()
Catch ex As Exception
AlertBox.Show(ex.Message)
End Try
scon.Close()
scon.Dispose()
Exit For
End If
Next
End If
End Sub
Hi Nicky,
Thank you for reaching out.
We can’t assist you if all we have is a snippet of code, it would be better if you can attach a runnable sample in order for us to help you!
I would also recommend that you take a look at our professional packages in case you need priority support!
More info here: Wisej.NET | Professional Packages
Best wishes,
Alaa
Please login first to submit.