473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Disabled ComboBox Text

To overcome the hard-to-read text associated with a disabled combobox, I
have created my own and overriden the OnEnabledChanged method as follows
(note the control also includes a DisabledBackColor property)

Protected Overrides Sub OnEnabledChanged(ByVal e As System.EventArgs)
'Call base method so delegates receive event (must do this first for
remaining code to work)
MyBase.OnEnabledChanged(e)
'Set BackColor
If Not MyBase.Enabled Then
'Set back color
MyBase.BackColor = m_DisabledBackColor
'Get the controls editbox
Dim hwnd As IntPtr = GetWindow(MyBase.Handle, GW_CHILD) 'GW_CHILD
= &H5
'Enable it so it adopts the controls BackColor and displays text in
normal ForeColor
SendMessage(hwnd, WM_ENABLE, 1, 0) 'WM_ENABLE = &H100
Else
'Set back color to original
MyBase.BackColor = m_BackColor
End If
End Sub

This works great except if the DropDownStyle is set to DropDownList, in
which case the text reverts to the faded style.
Can anyone offer any suggestions as to how I can make this work with a
DropDownList style?

Stephen
Nov 19 '05 #1
0 2791

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
2
by: Mike | last post by:
Hi, I need to disable comboboxes for users with view only permissions. However, that gray background just doesn't do it for me. Is there a way to change the background / text colors when...
3
by: Brian Mitchell | last post by:
Is it possible to change the fore and back colors of a combo box when its enabled property is set to false? I need to lock the value of my combo boxes (and still keep its color) but that control...
3
by: Brian Henry | last post by:
our form, when it is in read only mode has about 10 combo boxes on it, and a bunch of text boxes, now the text box has a read only property which makes the text black, but the combo box doesn't so...
5
by: DC | last post by:
Hi All, When a control is disabled, it is grayed out. Is there anyway to set a different foreground/background color for disabled controls (combobox, textbox, etc). Thanks. DC
4
by: Vish | last post by:
Hi, I need to make the text on a combobox that is disabled to be drawn with a black color. I was not able to find any help on this online. The drawItem seems to apply only for the dropdpwn...
4
by: Bob | last post by:
Hi, Is it possible to change the forecolor of a disabled text control. I have a RichText Box that I don't want the user to edit but the Grey on Grey default is hard to read. Is there a way of...
11
by: honey99 | last post by:
Hi! I have a combobox,it should be disabled when i select a value(say "post") from another combobox.it is working in IE but not in mozilla...can anybody help me??i'm sending the code.... Regards ...
3
by: kea62227 | last post by:
I have a combobox. In the validating event of the combobox I check what value is chosen. If the value is "Skip" then I set the next control in the tabindex to enabled=false. But when I tab out of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.