You need to hook up the SelectedIndexChanged event. Depending on whether this is a WinForms or Web App will determine the exact code but ultimately they're pretty much the same.
Daz Lewis
2010-07-09 08:57:26
You need to hook up the SelectedIndexChanged event. Depending on whether this is a WinForms or Web App will determine the exact code but ultimately they're pretty much the same.
You need to subscribe to SelectionChanged event of your ComboBox, then in eventhandler method use the following
if (comboBox.SelectedItem == null)
{
textBox.Text = string.Empty; //or any default value
return;
}
textBox.Text = comboBox.SelectedValue.ToString();
I think you can use binding to do that.
txtbox.DataBindings.Add("Text", comboBox, "Text")