Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
if (comboBox2.SelectedItem.ToString() == "Yes")
{
    textBox1.IsEnabled = false;
    textBox1.Text = "Good Health";
}
else
{
    textBox1.IsEnabled = true;
}



i have tried this and also used comboBox2.selectedvalue.equals("Yes") but the result is still the same.
Posted
Comments
Alexander Dymshyts 19-Dec-13 4:25am    
Can you check in debug mode the value of comboBox2.SelectedItem.ToString() and tell what does it show?
TheKingofdemon33 19-Dec-13 5:02am    
if your comboboxe's value is "Yes" then it should work. Please check and specify.

Here try this:
C#
if (comboBox2.SelectedItem.ToString() == "Yes")
{
    textBox1.Enabled = false;
    textBox1.Text = "Good Health";
}
else
{
    textBox1.Enabled = true;
}
 
Share this answer
 
Try like this,


C#
if (comboBox2.SelectedItem.ToString() == "Yes")
{
    textBox1.IsEnabled  Enabled = false;
    textBox1.Text = "Good Health";
}
else
{
    textBox1.IsEnabled  Enabled  = true;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900