i have a listview which is populated with a number of 'Appointments' and when selected this fills a number of lables with information.
now on the first click it works fine and everything gets populated but when a different row is selected i get an error.
the code im using is
Dim selection As ListViewItem = lstDays.GetItemAt(e.X, e.Y) If (selection IsNot Nothing) Then lblCustID.Text = selection.SubItems(2).Text FillCustData(selection.SubItems(2).Text) Else MsgBox("There is no current appointment set for " & selection.SubItems(2).Text & " Would you like to make one?") Return End If
the error is appearing on the row 'lblCustID.Text = selection.SubItems(2).Text '
with the error message
' InvalidArgument=Value of '2' is not valid for 'index'. Parameter name: index '
i wondered if anyone could help