Private Sub RefreshLV(ByVal Item As DataSet.categoryRow)
ListView1.BeginUpdate()
ListView1.Items.Clear()
For Each prod As DataSet.brandRow In Item.GetChildRows("cat")
Dim lvi As New ListViewItem(prod.id)
ListView1.Items.Add(prod.brand_name).SubItems.Add(prod.cat_id)
lvi.ImageIndex = 2
Next
ListView1.EndUpdate()
End Sub
Dim myDB As New Database()
Dim conn As New SqlCeConnection(myDB.Conn)
Try
Dim cmd As New SqlCeCommand(strSQL, conn)
conn.Open()
Dim rd As SqlCeDataReader
rd = cmd.ExecuteReader()
While rd.Read()
imageList1.Images.Add(New Bitmap("\Program Files\Image\" & rd("idx").ToString() & ""))
Me.listView1.Items.Add(New ListViewItem(rd("nme").ToString()))
End While
rd.Close()
Me.listView1.LargeImageList = imageList1
Me.listView1.SmallImageList = imageList1
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
conn.Close()
conn.Dispose()
End Try