If sqlDT.Rows.Count > 0 Then
lstitems.Items.Add(sqlDT.Rows(0)("Item_ID"))
lstitems.Items(lstitems.Items.Count - 1).SubItems.Add(sqlDT.Rows(0)("Purchase_Detail_ID"))
lstitems.Items(lstitems.Items.Count - 1).SubItems.Add(R_Change(sqlDT.Rows(0)("Item_Name")))
lstitems.Items(lstitems.Items.Count - 1).SubItems.Add(R_Change(sqlDT.Rows(0)("Item_Description")))
lstitems.Items(lstitems.Items.Count - 1).SubItems.Add(sqlDT.Rows(0)("Item_QTY"))
End If
Public Sub FillListView(ByVal sqlData As DataTable, ByVal lvList As ListView, ByVal imageID As Integer)
Dim i As Integer
Dim j As Integer
lvList.Clear()
For i = 0 To sqlData.Columns.Count - 1
lvList.Columns.Add(sqlData.Columns(i).ColumnName)
Next i
For i = 0 To sqlData.Rows.Count - 1
lvList.Items.Add(sqlData.Rows(i).Item(0), imageID)
For j = 1 To sqlData.Columns.Count - 1
If Not IsDBNull(sqlData.Rows(i).Item(j)) Then
lvList.Items(i).SubItems.Add(sqlData.Rows(i).Item(j))
Else
lvList.Items(i).SubItems.Add("")
End If
Next j
Next i
For i = 0 To sqlData.Columns.Count - 1
xsize = lvList.Width / sqlData.Columns.Count - 8
lvList.Columns(i).Width = xsize
Next i
End Sub