Murray Brown
asked on
ListView not loading properly
Hi
I am using the following code to load a ListView.
Only the first record "Number" seems to be loading correctly
even though my data looks as follows
I am using the following code to load a ListView.
Only the first record "Number" seems to be loading correctly
even though my data looks as follows
Sub Fill_Rooms_ListView()
Try
Me.ListView_Rooms.Items.Clear()
Me.ListView_Rooms.BeginUpdate()
Using myConnection As New OleDbConnection(ConnectionString)
Dim myCommand As New OleDbCommand("SELECT * FROM [Rooms]", myConnection)
myConnection.Open()
Using dr As OleDbDataReader = myCommand.ExecuteReader
Do While dr.Read
Dim myItem As ListViewItem = Me.ListView_Rooms.Items.Add(dr("Number").ToString())
myItem.SubItems.Add(dr("Rate Single").ToString())
myItem.SubItems.Add(dr("Rate Double").ToString())
myItem.SubItems.Add(dr("Description").ToString())
Loop
End Using
End Using
Catch ex As Exception
MsgBox(ex.Message)
Finally
Me.ListView_Rooms.EndUpdate()
End Try
End Sub
image2.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You will need 4 columns instead of 3
ASKER
thanks very much
Glad to help
Open in new window