Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2007-10-11
17
Medium Priority
?
289 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:DeniseGoodheart
  • 7
  • 6
  • 4
17 Comments
 
LVL 2

Accepted Solution

by:
RayAtVittoria earned 750 total points
ID: 20060671
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
 
LVL 21

Expert Comment

by:surajguptha
ID: 20060690
Thats just because you have selected the item. tab out of the item and you should see yellow
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20060700
Is this a windows or a web app?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:DeniseGoodheart
ID: 20060818
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
 
LVL 21

Expert Comment

by:surajguptha
ID: 20060882
Can you try this?
cboTaxable.BackColor = System.Drawing.Color.Yellow
0
 
LVL 2

Expert Comment

by:RayAtVittoria
ID: 20060909
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
 

Author Comment

by:DeniseGoodheart
ID: 20061112
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
 
LVL 21

Expert Comment

by:surajguptha
ID: 20061154
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
 
LVL 2

Expert Comment

by:RayAtVittoria
ID: 20061187
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
 
LVL 21

Expert Comment

by:surajguptha
ID: 20061198
yeah like ray says its possible. check my first comment :)
0
 

Author Comment

by:DeniseGoodheart
ID: 20061202
surajguptha:

Are you using VS.NET 2005?
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20061220
Yes
0
 

Author Comment

by:DeniseGoodheart
ID: 20061609
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
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 750 total points
ID: 20061714
0
 

Author Comment

by:DeniseGoodheart
ID: 20081641
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
 
LVL 2

Expert Comment

by:RayAtVittoria
ID: 20092565
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
 

Author Comment

by:DeniseGoodheart
ID: 20186658
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

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question