private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
primary = comboBox2.SelectedText;
}
and select something from the list, primary is ending up as an empty string. Why is that
Windows Forms General
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
primary = comboBox2.SelectedText;
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
Hi, actually "this.comboBox1.SelectedText" gets the current highlighted text inside the combobox
I suppose "this.comboBox1.Text" is the one that you were looking for
MSDN library wrote:
Property ValueA string that represents the currently selected text in the combo box. If DropDownStyle is set to DropDownList, the return value is an empty string ("").
Hi . as moderator replayed you , SelectedText is text of the editable "textbox" portion of the combobox. The selecteditem targets the "listbox" portion of the combobox. but i'd like to say that , it depends of how you use the ComboBox control. i mean in connected or disconnected mode. If you uses connected mode by setting DataSource SelectedText will work fine . Else you fill it manually, then is working in so called 'disconnected' mode then " Text " Property will work in this disconnected mode .