listView + events
(Tuesday, January 03, 2006)
Found the following interesting discussion in the Newsgroups:
listView + events by:Won Lee
| How come there isn't an event handler for when an item or subitem of a listview changes?
| | | Reply: by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])
| | |
Subitems cannot edited directly by the user, so there is no need for such an event. As a programmer, you should know yourself when you change the text if a subitem.
-- Herfried K. Wagner [MVP]
| | | Reply: by:Won Lee
| | |
Ahh ok. That makes sense. Except I have need to call a method which calls another form. It works fine when I call the methods in any other method but specific datastream handler that I'm using. I can't actually see the code for the datastream event handler because I'm referencing a DLL.
I'm not sure why it's happening. It doesn't seem to be fixable from my side. I need to move the method call to another part of the app. I was hoping that I could add an event handler on the subitems but that doesn't seem to work. I did try to also select the item when I add the subitem.
Dim li As ListViewItem
ListView1.SelectedItems.Clear() For Each li In ListView1.Items If li.Text = symbol Then li.SubItems.Add("X") li.Selected = True Console.WriteLine("selected: " & li.Text) Exit For End If Next li Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged Console.WriteLine("selectedIndexChanged1") Try Console.WriteLine("subitem" & ListView1.SelectedItems.Item(0).SubItems(0).Text) If ListView1.SelectedItems.Item(0).SubItems(0).Text = "X" Then Console.WriteLine(ListView1.SelectedItems.Item(0).Text) Console.WriteLine(ListView1.SelectedItems.Item(0).SubItems(0).Text) CallAlertBox(ListView1.SelectedItems.Item(0).Text) End If
Catch ex As Exception Console.WriteLine(ex) End Try
End Sub
But I'm getting an array out of bounds error
|
Posted by Xander Zelders

|
|
|
|
0 Comments:
Post a Comment
<< Home