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

Enabled function

Status
Not open for further replies.

hanglam

Programmer
Dec 11, 2002
143
US
Hi,

In VB.NET 2005 , I'm trying to creat a Windows app which has a bunch of Combobox .

When I used the following function call:

combobox.Enabled = False , the combobox back color turns into a LighGray color.

Is there anyway to just disabled the combobox without changing its backcolor ?

Thanks,
Hang
 
You will probaby want to create a "helper" function that when you want to disable the function it also sets the styles that you are looking for.

-The answer to your problem may not be the answer to your question.
 
Qik3Coder ,

I tried that.

combobox.Enabled = false
combobox1.backcolor = color.white

It seems VB.NEt automatically turn the combobox grey if you set it to combobox.Enabled = false .

Is there any way to turn this functionality off ?

thanks,
hang
 
its the forecolor that gets set to grey.

-The answer to your problem may not be the answer to your question.
 
Sorry hanglam, i didnt try my own answer. for whatever reason it seems you cannot change the forecolor on the checkbox when it's disabled.

I found this post, which you might be able to use:

thread796-1111971

it suggests setting the autocheck property to false, so they cannot actually select the box.

-The answer to your problem may not be the answer to your question.
 
This is the default behavior for Windows controls. It indicates to the user that they cannot interact with the disabled control.

If you want different behavior, try a 3rd party control, or write your own custom combobox control.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top