How to close DropDown window of a comboBox

  • Thread starter Thread starter glerner
  • Start date Start date
G

glerner

When a user clicks on a comboBox dropdown, I want to close the
dropdown and do something else (such as open up a form). How can I
programmatically close the dropdown?

Thanks,
Glenn
 
Glenn,

You can call the SendMessage API function through the P/Invoke layer,
sending the CB_SHOWDROPDOWN message to indicate that the dropdown list
should be closed.

Also, if you want to prevent the combo box from being shown, you can
have the parent window message procedure handle the CBN_DROPDOWN message,
which is sent before the drop down is exposed.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

glerner said:
When a user clicks on a comboBox dropdown, I want to close the
dropdown and do something else (such as open up a form). How can I
programmatically close the dropdown?

Thanks,
Glenn
 
Back
Top