By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,152 Members | 1,647 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,152 IT Pros & Developers. It's quick & easy.

Un Dropping Down a Drop Down

P: n/a
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?

Jul 25 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a

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

Adrian.
--
[Please mark my answer if it was helpful to you]


"za***@construction-imaging.com" wrote:
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?

Jul 26 '07 #2

P: n/a

Maybe: ComboBox.Refresh
"za***@construction-imaging.com" wrote:
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?

Jul 26 '07 #3

P: n/a
On Jul 25, 11:32 pm, Tracks <Tra...@discussions.microsoft.comwrote:
Maybe: ComboBox.Refresh
Thenks, but it didn't help.
>
"za...@construction-imaging.com" wrote:
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?- Hide quoted text -

- Show quoted text -

Jul 26 '07 #4

P: n/a
On Jul 26, 8:40 am, za...@construction-imaging.com wrote:
On Jul 25, 11:32 pm, Tracks <Tra...@discussions.microsoft.comwrote:
Maybe: ComboBox.Refresh

Thenks, but it didn't help.
"za...@construction-imaging.com" wrote:
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?- Hide quoted text -
- Show quoted text -
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

Jul 26 '07 #5

P: n/a
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

Jul 26 '07 #6

P: n/a
On Jul 26, 9:14 am, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Jul 26, 8:40 am, za...@construction-imaging.com wrote:


On Jul 25, 11:32 pm, Tracks <Tra...@discussions.microsoft.comwrote:
Maybe: ComboBox.Refresh
Thenks, but it didn't help.
"za...@construction-imaging.com" wrote:
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?- Hide quoted text -
- Show quoted text -

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!

Jul 26 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.