7 Years
Discussion Span
Last Post by Unhnd_Exception

I did get it figured out.

Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
        TextBox1.Text = ListView1.SelectedItems(0).Text
    End Sub

But I keep getting an Error that I cant figure out.

InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index

It Works when I select the First thing. Like First Selection no matter what row. But when I go to select another row. It Gives me that Error.

Any Ideas?? Thanks


Selected index changed will raise the event twice when changing. The first one will be a selected index of -1 when its deselecting the current item and the next will be the newly selected index. Its kind of stupid if you ask me. That had troubled me a couple of times.


if selecteditems.count = 0 then exit sub at the top of the sub.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.