473,395 Members | 1,411 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,395 software developers and data experts.

Change forecolor of selected value in combobox

Hi!

How can I change forecolor of a selected value in combobox?

when I select a value in a combobox and press a button to "activate" what I've selected I want the text to be green and then black when I select another value.
Nov 28 '08 #1
1 2095
nukefusion
221 Expert 100+
Add eventhandlers for the SelectedIndexChanged event of the combo box and on the Click event of the button and change the colours there.

Something like this:

Expand|Select|Wrap|Line Numbers
  1.    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  2.         {
  3.             comboBox1.ForeColor = Color.Black;
  4.         }
  5.  
  6.         private void cmdActivate_Click(object sender, EventArgs e)
  7.         {
  8.             comboBox1.ForeColor = Color.Green;
  9.         }
  10.  
Nov 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Allcomp | last post by:
Hello, I would like to change the Forecolor of a comboItem (of a ImageCombo), but I can't make it. I can't see any forecolor in the method or properties. If I change the forecolor of the...
2
by: Dwight | last post by:
Help ! Have a combo box in accsess, with 6 fields, I want each to show up a different colour when they ar selected/viewed. I have tried the following code but seems to have no affect can anyone...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
4
by: mg | last post by:
How can I change the color of the display text beside a single ListItem of a RadioButtonList when the associated radiobutton is selected - hopefully using C# in the codebehind of a WebForm? ...
4
by: Rob Kroese | last post by:
I've got a form with a datagrid that displays a list of items, along with several textboxes, comboboxes, etc., that display the details for the selected item. The columns in the datagrid and the...
2
by: Kevin Hodgson | last post by:
I have a DataBound ComboBox, which has a text value as the Value property, and the UniqueID for that value is bound to the Combobox.Tag property. When a user makes a new selection in the...
1
by: Kevin Hodgson | last post by:
I have a DataBound ComboBox, which has a text value as the Value property, and the UniqueID for that value is bound to the Combobox.Tag property. When a user makes a new selection in the...
2
by: shumaker | last post by:
I have a combobox that is very much like the one found in the RSS project here: http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/ My projectNameComboBox basically is filled with a...
3
by: CSharper | last post by:
Is it possible to selectivly change the color of an item in text. I saw ForeColor option, but it changes the color of all the items. If it is not possible, is there any other control list listbox...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.