Hello,
I'd Like to do the Same thing as in this post I posted a while back. But in a Listview Control http://www.daniweb.com/software-development/vbnet/threads/369754

But there is no Selected rows...

There is an Item Active But that did not work. And I cant find this anywhere else.
Can someone help?

Thanks,
Joshua K

P.S. for Topic I meant to put Help with ListView

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

Member Avatar for Unhnd_Exception

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.

Add

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.