Problematic comboBox Windows Forms

Posted by zaidwaqi on Stack Overflow See other posts from Stack Overflow or by zaidwaqi
Published on 2010-05-28T18:05:09Z Indexed on 2010/05/28 18:22 UTC
Read the original article Hit count: 192

Hi,

I use VS2008 C# + Windows Forms. I can't understand why comboBox does not behave the way it should. In Design mode, I added a comboBox to my form, and edit Items to add "A" and "B". Double-clicking brings me to SelectedIndexChanged event, which I edit to display the selected text with MessageBox.

private void comboBoxImageSet_SelectedIndexChanged(object sender, EventArgs e)
{
    MessageBox.Show(comboBoxImageSet.SelectedText);
}

When I run, and select "A" or "B" in the comboBox, the MessageBox appears, but nothing is written. Why?

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET