October 19th, 2003, 07:29 AM
VB6 - ListBox with CheckBox Style?
I use the ListBox with the CheckBox style in my form.
The problem is that if the user want to mark one item he need to double click on the item and not one click.
Any one ca tell me how to get it done with one click?
October 19th, 2003, 12:24 PM
try one of these 2:
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Item.Checked = Not Item.Checked
Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
ListView1.HitTest(x, y).Checked = Not ListView1.HitTest(x, y).Checked
October 21st, 2003, 02:53 AM
This is .Net i ask about VB 6.
October 21st, 2003, 05:07 PM
nope, this is vb6, not .NET.....
October 22nd, 2003, 12:32 AM
I cant find this events, but i see that you write ListView- i use ListBox.
The ListBox don't have the HitTest function and ItemClick event with the argument that you wrote.
October 22nd, 2003, 05:49 PM
Many apologies - listbox, not listview!
I find the listbox control a pain in the a*se. See the following code, it should be sufficient...
Private mblnLoading As Boolean
Private mblnBusy As Boolean
Private Sub Form_Load()
Dim X As Integer
mblnLoading = True
For X = 0 To 9
.Selected(X) = True
Next ' x
mblnLoading = False
Private Sub List1_ItemCheck(Item As Integer)
If mblnLoading = False And mblnBusy = False Then
List1.Selected(Item) = Not List1.Selected(Item)
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mblnBusy = True
List1.Selected(List1.ListIndex) = Not List1.Selected(List1.ListIndex)
mblnBusy = False
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!