Change forecolor of selected value in combobox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Joel1334
    New Member
    • Nov 2008
    • 1

    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.
  • nukefusion
    Recognized Expert New Member
    • Mar 2008
    • 221

    #2
    Add eventhandlers for the SelectedIndexCh anged event of the combo box and on the Click event of the button and change the colours there.

    Something like this:

    Code:
       private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                comboBox1.ForeColor = Color.Black;
            }
    
            private void cmdActivate_Click(object sender, EventArgs e)
            {
                comboBox1.ForeColor = Color.Green;
            }

    Comment

    Working...