Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox in Listbox

Status
Not open for further replies.

mharcourt

Programmer
Apr 9, 2003
49
0
0
US
I am using a listbox with checkboxes. I'm looking for a way to have the checkbox change its state (unchecked to checked or checked to unchecked) if a user clicks on an item. Silly of me to assume a checkbox and the item are treated as one object. Any help would be greatly appreciated.
 
Hi,

when the checkbox is changing the it's value the ItemCheck event fires.

Best regards,
Tibi
 
Private Sub lstUsers_ItemCheck(Item As Integer)
Dim u As Integer
Dim Index As Integer
Index = lstUsers.ListIndex
For u = 0 To lstUsers.ListCount - 1
If lstUsers.Selected(u) Then lstUsers.Selected(u) = False
Next
lstUsers.Selected(Index) = True
End Sub

Swi
 
The itemcheck sub does not seem to kick in until you either select the item twice or double click on the item. Shouldn't this kick in on one click? Also, if multiple selections are required do I need to track previous selections?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top