|
-
Apr 14th, 2002, 01:59 PM
#1
Thread Starter
Fanatic Member
listview subitem select problem
Hi,
i have a listview ( view property set to Details ) fully populated and i want to be able to, when the listview item is changed it to tell me whats in the second column along. To do this i have used..
VB Code:
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
MsgBox(ListView1.SelectedItems.Item(0).SubItems(1).Text)
End Sub
Now if i click on a item in the listview, it popups a msgbox telling whats in the second column along, but if i then choose another item i get the following error
Additional information: Specified argument was out of the range of valid values.
can someone please explain what im doing wrong
-
Apr 15th, 2002, 12:31 PM
#2
Lively Member
trap the error to get some better error description
VB Code:
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
on error goto errHandler
MsgBox(ListView1.SelectedItems.Item(0).SubItems(1).Text)
exit sub
errHandler:
msgbox err.description.tostring
End Sub
or use try - catch.
what error description are you getting? sometimes it is more usefull than the error message you receive
-
Apr 15th, 2002, 04:52 PM
#3
Thread Starter
Fanatic Member
thanks for your reply, this is the error i get
Additional information: Specified argument was out of the range of valid values.
i didnt think about using try, i will try that, thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|