Hi there
Below is some of my code in VB6 that use to add items to a listview
with subitems:
The listview is called lstvCustomers that gets data from a Access DB
I know how to access data from access and I know how to add the data
in the 1st column
my problem is adding the remaining data in the subitem of VB 2005
VB Version 6 Code:
Set Result = lstvCustomers.ListItems.Add(, , orec!Customer_AccNumber)
With Result
.SubItems(1) = orec!Customer_Name
.SubItems(2) = orec!Customer_Surname
.SubItems(3) = orec!ID_Provided
.SubItems(4) = orec!Customer_Phone
.SubItems(5) = orec!Customer_Fax
.SubItems(6) = orec!Customer_Cell
orec.MoveNext
End With
=====================================================================
VB 2005 Code:
oledbcon.Open()
Dim strSQL As String = “SELECT * FROM Customers”
Dim cmd As OleDbCommand = New OleDbCommand(strSQL,
oledbcon)
Dim objread As OleDbDataReader
objread = cmd.ExecuteReader
While objread.Read
lsvCustomers.Items.Add(objread(“Customer_AccNumber”))
End While
objread.Close()
=====================================================================
im stuck by the part where i have to add subitems
my listview is designed the same way it was in VB6 with the 7 columns
Please Assist
Thanks
Mr Rieda Hoosain