C
cr113
I've found an obvious bug in VS2005 (VB.NET), in the Listview object.
I desperately need a fix. To duplicate do the following:
1. Create a new Visual Basic Windows Application.
2. Add a Listview object and Textbox object to the Form.
3. Add a column to the Listview Column collection.
4. Set the Listview View property to Details.
5. Set the Listview FullRowSelect property to True.
6. Add the following code to the Form:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
ListView1.Items.Add("aaa")
ListView1.Items.Add("bbb")
ListView1.Items.Add("ccc")
End Sub
Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
TextBox1.Text = ListView1.SelectedItems(0).Text
End Sub
Click on a few different rows in the Listview box and you'll get an
error saying the selected index is not set. It appears that the
selected index collection is being updated AFTER the
SelectedIndexChanged event. Is there a fix for this?
I've tried searching thru Microsoft to see if I'm missing the latest
Service Pack for Visual Studio 2005 but have had no luck.
Thanks!
I desperately need a fix. To duplicate do the following:
1. Create a new Visual Basic Windows Application.
2. Add a Listview object and Textbox object to the Form.
3. Add a column to the Listview Column collection.
4. Set the Listview View property to Details.
5. Set the Listview FullRowSelect property to True.
6. Add the following code to the Form:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
ListView1.Items.Add("aaa")
ListView1.Items.Add("bbb")
ListView1.Items.Add("ccc")
End Sub
Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
TextBox1.Text = ListView1.SelectedItems(0).Text
End Sub
Click on a few different rows in the Listview box and you'll get an
error saying the selected index is not set. It appears that the
selected index collection is being updated AFTER the
SelectedIndexChanged event. Is there a fix for this?
I've tried searching thru Microsoft to see if I'm missing the latest
Service Pack for Visual Studio 2005 but have had no luck.
Thanks!