Page 1 of 1

Damn listbox Madness (-please help me-)

Posted: Mon Dec 03, 2012 5:35 pm
by muttley1968
Hi i have to listboxes laid out like so


Richard Richard
Tom Tom

and so on all i want is if you click a name in one it will click it in the other i tried this code
Code: Select all
    Private Sub ListBox2_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox2.DoubleClick
        ListBox1.SelectedIndex = sender.Tag
    End Sub
and it does nothing only click staright to the top one and then dies wont work again wont do anything just stays their any ideas on how to change this so it will work please people

Re: Damn listbox Madness (-please help me-)

Posted: Mon Dec 03, 2012 5:44 pm
by CodenStuff
Try
Code: Select all
    Private Sub ListBox2_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox2.DoubleClick
        ListBox1.SelectedItem = CType(sender, ListBox).SelectedItem
    End Sub

Re: Damn listbox Madness (-please help me-)

Posted: Mon Dec 03, 2012 6:49 pm
by muttley1968
that didnt work but i changed it to

Private Sub ListBox2_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox2.DoubleClick
ListBox1.SelectedIndex = CType(sender, ListBox).SelectedIndex
End Sub

and works great thanks Codenstuff