Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Controls / July 2009



Tip: Looking for answers? Try searching our database.

like to have a disabled listbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter - 25 Jun 2009 22:07 GMT
Dear all
In my VB6 app I have a Listbox that is filled with various entries.
In a certain situation I like to disable the Listbox so that the user can
not select an item.
He should just be able to view the list without doing any selection.
I tried this by using Listbox1.Enabled=false
However, setting property .Enabled=false also prevents the user to scroll
down the listbox.
Does anyone know is there a way to have a disabled Listbox where vertical
scrolling works?
Regards
Peter
Timo Kunze - 25 Jun 2009 22:24 GMT
There's the LBS_NOSEL window style for list boxes. It seems to be
exactly what you're looking for. However, setting this style after the
control has been created, probably won't have any effect. But you should
give it a try.

Timo
Signature

www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."

MikeD - 26 Jun 2009 02:07 GMT
> Dear all
> In my VB6 app I have a Listbox that is filled with various entries.
[quoted text clipped - 6 lines]
> Does anyone know is there a way to have a disabled Listbox where vertical
> scrolling works?

Well....any action that occurs by a user selecting an item is done by your
code most likely in the ListBox's Click event.  So what if the user can
still select an item....it's what's done by your code as a result of that
action that matters.  So...in those "certain situations", set a flag and
check the value of that flag in the ListBox's Click event, and if
appropriate don't have your code do anything.

Other than that, use a different control. Afterall, a ListBox *is* intended
for a user to select something from a list.

Signature

Mike

Rick Raisley - 26 Jun 2009 16:32 GMT
Or, just add code in the Click event that un-selects all rows. The user will
be able to select them, but as soon as the mouse is released, the
highlighted rows will unhighlight.

Signature

Regards,

Rick Raisley
heavymetal-A-T-bellsouth-D-O-T-net

>> Dear all
>> In my VB6 app I have a Listbox that is filled with various entries.
[quoted text clipped - 16 lines]
> Other than that, use a different control. Afterall, a ListBox *is*
> intended for a user to select something from a list.
Peter - 07 Jul 2009 06:33 GMT
Many Thanks for your answers and sorry for my late reply.
The reason why I like to have a disabled listbox is:
In my application the user can choose one of several items from the listbox.
At this time the listbox is enabled.
At another stage the user is able to add further items to this listbox by
pressing a button(which opens a textbox where he can type in the new item).
While the user can enter a new item I like to show him all existing items
via a disabled listbox.
I like to have a listbox here as well to maintain the same user interface
instead of confusing the user with another control.
I thought that there is maybe an "easy way" to disable a listbox via api
call but leave the vert. scrollbar enabled.
At the moment I follow Ricks suggestion to leave the listbox enabled and
deselect all items in the click event.
This seems to be a good compromise.
If anyone can suggest any other ideas then please let me know
Best regards
Peter
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.