Link to home
Start Free TrialLog in
Avatar of DeniseGoodheart
DeniseGoodheart

asked on

How to Make an Entire Combo/Drop Down List Box BackColor=Yellow

Good Day:

I am using VB.NET 2005.  I would like to have my combo/drop down list box control backcolor to be yellow.  The following code only outlines the combo/drop down list box to yellow and shows the backcolor as the system default color blue:

cboTaxable.BackColor = System.Drawing.Color.FromName(yellow)

Any Suggestions?
Thank You,
Denise
ASKER CERTIFIED SOLUTION
Avatar of RayAtVittoria
RayAtVittoria
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thats just because you have selected the item. tab out of the item and you should see yellow
Is this a windows or a web app?
Avatar of DeniseGoodheart
DeniseGoodheart

ASKER

Hi All,

Thanks for the suggestions.  This is a WindowsForms application.  I left out details for simplicity.  Here are the rest of the details.  It does not work when I use the Enter Event as follows:

Private Sub cboTaxable_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboTaxable.Enter

               cboTaxable.BackColor = System.Drawing.Color.FromName("yellow")
       
    End Sub

Thank You,
Denise

Can you try this?
cboTaxable.BackColor = System.Drawing.Color.Yellow
I did this on a test form and it works when I enter the combobox. colour changes to yellow as expected. So I suspect it might have something to do with your windows colour scheme blocking things.

Private Sub ComboBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Enter
        Me.ComboBox1.BackColor = Color.Yellow
    End Sub
Hi All,

The backcolor only works when the DropDownStyle=Simple or DropDown.  When I have it set to DropDownList it does not work.  I need to have it set at DropDownList to prevent users from typing random entries.  

Any More Suggestions?
Thank You,
Denise
It wouldnt make a difference if is a dropdown or a dropdownlist you should still be able to look at the background color as yellow.

I tried it here and it shows yellow for both types
OMG...
I just tested this with Dropdown style=DropDownList... It works fine.
However... As long as the field retains focus the background will be Blue! Click elsewhere and you will note it reverts to yellow (unless of course on the Leave event you set it back to white)

Ray
yeah like ray says its possible. check my first comment :)
surajguptha:

Are you using VS.NET 2005?
Hi All,

I apologize for giving you all bits and pieces, but I was trying to simplify the question.  Yes, when the combo box is set to DropDownList; the backcolor=yellow when it LOSES the FOCUS, but the requirement is the following:

The control that has the focus shall have a backcolor=yellow
When the control loses the focus; it shall have a backcolor=white

Yes, my combo box backcolor=yellow when it loses focus and it is set to DropDownStyle=DropDownList; but this does not meet the requirment.

Any More Suggestions?
Thanks,
Denise
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
surajguptha:

Well the person posted a question for the link you suggested, but no one posted a solution, so it is not going to help me.

Thanks
Hi Denise,

I just read the link posted by surajguptha. There is indeed a fairly complex response that I am sure will do what you need. However if you need clarification you might email the woman who gave the answer.

Check it again...

Cheers
Ray
Hi All:

Thanks for trying to help, but unfortunately the suggetions did not work, and the link provided required too much time for such a simple requirement.  Perhaps my setting are different or I did not explain myself clearly, but I appreicate all your efforts.

Cheers,
Denise