views:

162

answers:

3

Hi everybody,
A ComboBox within a Form (modal dialog) does not open when clicked, however an item can be selected by using the up/down arrow keys. After clicking on another window and the back on the dialog, the ComboBox works as expected, i.e. expands on click.

Weird... any ideas what could be causing this behavior?

Thanks a lot in advance, Peter

EDIT: The Combobox is created by compile time, but populated by runtime.

Invalidating Combobox and enclosing Form did not help.

Following Henk's suggestion, I tried adding a new Combobox using the designer, which results in exactly the same code the existing Combobox has. The new Combobox works fine when empty, but adopts the strange behavior as soon as set the datasource programmatically... Here's what I am doing:

comboBox1.DataSource = langs;
comboBox1.DisplayMember = "NativeName";
comboBox1.ValueMember = "Name";

(langs is a List<CultureInfo> with two entries)

Hmmmm. If I preset the Items property with any two items (e.g. "A", "B"), everything works fine..... Huh? This works for me, but seems odd. Is this a bug? (No, not really, misconception on my side)

A: 

Perhaps some event like the OnClick is implemented which sets e.handled to true?

Also, how do you insert the combobox, runtime or compile time? If runtime, perhaps you missed something?

Henri
Thanks for your suggestions. No, there's nothing attached to any event, only OnClick for the OK button. The comboxbox is inserted by compile time (#develop designer), but populated by runtime.
peter p
Btw. just tried invalidating after updating the datasource, but this did not help :(
peter p
A: 

Changing the Combobox' TabIndex from 1 to 3 did the trick. Don't ask me why... :-/

peter p
A: 

Have you tried dragging the drop down area of your combo box in the designer?

Phil