Un Dropping Down a Drop Down

Z

zacks

I have an application I am developing that has a Combo Box that is
intended to show a list of available tables in the selected DSN. I
have put code in the control's DropDown event handler to clear the
item list and reload it from the currently specified DSN (in a Text
Box control on the same form). This works well.

BUT ... if the specified DSN is invalid, I can display an appropriate
error message, but then then empty dropdown list is still displayed. I
have tried to suppress it by setting the control's DroppedDown
property to false if the error is encountered, but the empty dropdown
list is still being displayed and I have to click on the dropdown
button again to make it go away. What is also interesting is when I
click on the dropdown button to make it go away, the DropDown event
does not fire, only when it is first clicked.

So, how do I un-drop down a drop down?
 
G

Guest

If there is an error, you could just hide the drop down list to prevent the
user from using it.

Adrian.
 
R

rowe_newsgroups

Thenks, but it didn't help.

Alt + Down will toggle the drop down list up or down so you could
experiment with either SendKeys.Send or even try using the SendMessage
API to tell the combobox's handle to try to force the drop down to
hide.

Good Luck!

Thanks,

Seth Rowe
 
M

Marc Gravell

IIRC, setting DroppedDown in the handler is too soon, and it doesn't
work. You could try adding a delay, either using this.BeginInvoke, or
a short timer?

Marc
 
Z

zacks

Alt + Down will toggle the drop down list up or down so you could
experiment with either SendKeys.Send or even try using the SendMessage
API to tell the combobox's handle to try to force the drop down to
hide.

The Alt Down does work from the keyboard. So I put an:

SendKeys.Send("%{down}")

in the DropDown event error branch, but alas, it does not appear to
have any effect.

It's almost like the dropdown occurs AFTER and user code in the
DropDown event, and there is not a DroppedDown event to put code in to
undrop it.

ARGHHH!
 

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

Top