[2005] Listview Selected Item
Hello,
I have a listview on my form which is filled from a dataset.
One of my rows is 'Modified By' which is populated if the record has been changed, but is blank otherwise.
I want to capture the information from this 'Modified By' field, but am having problems if the field is blank.
Basically my code is
Code:
If Listview1.SelectedItems(0).SubItems(3).Text = 'ABCDEFG' then
do stuff ...........
This works fine if the field has data in it, but if it is blank then I get an error saying :
"InvalidArgument=Value of '3' is not valid for 'index'.
Parameter name: index"
Can I get round this ?
Thanks in advance.
Re: [2005] Listview Selected Item
put a check around that if checking the count of the subitems to make sure that there is an an item at that index.
Obviously you can modify this as needed but this will check to make sure ther are at least 4 subitems.
Code:
If Listview1.SelectedITems(0).SubItems.Count > 3 Then
'Add yor function in here
End If