How to close DropDown window of a comboBox

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
 
N

Nicholas Paldino [.NET/C# MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top