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!

ListBox Selected Item

Status
Not open for further replies.

kel1981b

Programmer
Jan 3, 2003
82
0
0
US
Question is about ListBox selected item. I am using ListBox with Check Boxes. Clicking/selecting CheckBox causes highlihting of Item, which is good. However, for some reason(s), Item remains highlighted even if CheckBox is unselected. Moreover, clicking Item itself cause the same effect like clicking CheckBox, which is not good. Does any body knows way to fix this problem? I hope explanation of my problem is clear, if not let me know. Thanx a lot.
 
Unfortunately, that's just the way they act. There's nothing in their properties that would indicate otherwise.

--Bill
One may not reach the dawn save by the path of the night
--Kahlil Gibran
 
I've already knew that. My question was may be somebody know API or ListBox structure which control it. For example using
Code:
Private Const LB_SETSEL = &H185&
SendMessage(ListBox.hwnd, LB_SETSEL, False/True, ByVal -1)
you can unchecked/checked all CheckBoxes. So, I was thinking [ponder] about correct value for LB_SETSEL ...
 
Couldn't you add a little code to the click event (or other) to see if a checkbox status changes---then set the selected property to false?

There's no chr$(27)!
 
Try
Private Sub List1_LostFocus()
List1.ListIndex = -1
End Sub
 
Thax a bunch DrJavaJoe [thumbsup2][thumbsup2][thumbsup2] ! It does work!
 
Thanks DrJavaJoe!

--Bill
One may not reach the dawn save by the path of the night
--Kahlil Gibran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top