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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox Question

Status
Not open for further replies.

nwb1

Programmer
Apr 28, 2004
39
GB
Is there a way to lock the ListBox (check box listBox) as same way as TextBox?
I have a ListBox in my project where its items get populated programmatically and I want my uses to have access in record view mode (scroll up/down) but allow no editing (no checking/un-checking items) .
I'm currently using Enable property to False in view mode. The problem with that is my users can not see all the items as they can not scroll when the control disabled.
Any help greatly appreciated.
Thanks

 
You might try setting the ITEMDATA property of each row to whether it is selected or not.

Then, you can use this code to get the effct you need:
Code:
Private Sub List1_ItemCheck(Item As Integer)
'2 lines to stop recursion
Static bchanging As Boolean 
If bchanging Then Exit Sub

'signal that we are changing the value in code
    bchanging = True
'set the value to the one WE want
    List1.Selected(Item) = List1.ItemData(Item) 
'(itemdata holds true or false, or 0/1)
'signal that we are finished
    bchanging = False
End Sub
 
Thanks for your input. I think that's a better way of handeling this.
Will give it a try.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top