467,135 Members | 1,197 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,135 developers. It's quick & easy.

List Box issue

I have a little program that has several list boxes. If I click on an item
in one list box, it highlights the selection. If I click on another item in
a DIFFERENT list box, it highlights that selection. The problem is, the 1st
item chosen is still highlighted. If I have 6 list boxes, I could
potentially have 6 items highlighted. How do you have the current selection
be the only item highlighted and all other items in the other list boxes not
be highlighted?

Thanks,
jasper
Jul 21 '05 #1
  • viewed: 1177
Share:
1 Reply
Jasper,

The selected items within different listviews are independent and there is
no built in functionality to link these items. What you can do however is
create an event handler that handles the click event for all four
listviews. Then what you could do in your event handler is identify which
listview was clicked on and then unselect the selected items for the
listboxes that were not clicked.

So, somewhere within your initialization code you'd wire up the events:

AddHandler ListView1.Click, AddressOf ListView_Clicked
AddHandler ListView2.Click, AddressOf ListView_Clicked
AddHandler ListView3.Click, AddressOf ListView_Clicked
AddHandler ListView4.Click, AddressOf ListView_Clicked

And then you'd have the event handler:

Private Sub ListView_Clicked(ByVal sender As System.Object, ByVal e As
System.EventArgs)
If Not CType(sender, ListView).Name = "ListView1" Then
ListView1.Clear()
End If

If Not CType(sender, ListView).Name = "ListView2" Then
ListView2.Clear()
End If

If Not CType(sender, ListView).Name = "ListView3" Then
ListView3.Clear()
End If

If Not CType(sender, ListView).Name = "ListView4" Then
ListView4.Clear()
End If
End Sub


Thanks! Robert Gruen
Microsoft, VB.NET

This posting is provided "AS IS", with no warranties, and confers no rights.

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Guy Hocking | last post: by
57 posts views Thread by Xarky | last post: by
27 posts views Thread by Tripper | last post: by
65 posts views Thread by Steven Watanabe | last post: by
9 posts views Thread by gamehack | last post: by
4 posts views Thread by phcmi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.