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
DeniseGoodheartAsked:
Who is Participating?
 
RayAtVittoriaCommented:
I tested this by setting the BackColour directly on the form and it works.
Also Programmatically I entered this on the Load and it worked

Me.ComboBox1.BackColor = Color.Yellow
If this doesn't work it might be something to do with Windows colour schemes.
0
 
surajgupthaCommented:
Thats just because you have selected the item. tab out of the item and you should see yellow
0
 
surajgupthaCommented:
Is this a windows or a web app?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
DeniseGoodheartAuthor Commented:
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

0
 
surajgupthaCommented:
Can you try this?
cboTaxable.BackColor = System.Drawing.Color.Yellow
0
 
RayAtVittoriaCommented:
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
0
 
DeniseGoodheartAuthor Commented:
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
0
 
surajgupthaCommented:
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
0
 
RayAtVittoriaCommented:
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
0
 
surajgupthaCommented:
yeah like ray says its possible. check my first comment :)
0
 
DeniseGoodheartAuthor Commented:
surajguptha:

Are you using VS.NET 2005?
0
 
surajgupthaCommented:
Yes
0
 
DeniseGoodheartAuthor Commented:
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
0
 
DeniseGoodheartAuthor Commented:
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
0
 
RayAtVittoriaCommented:
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
0
 
DeniseGoodheartAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.