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

ComboBox and automatic dropDown

P: n/a
VB 7.1 and windows.forms.

I have a comboBox on a form.
When the user goes with TAB-Key to the comboBox,
the comboBox should dropDown the ListBox automatically
and show ALL entries.
The user has no possibility to use a mouse !!

How can I program a automatic dropDown ( Showing all entries ),
if the user tabs to the comboBox ???
Thanks
for any help
Peter

Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hello...
One solution is to write a custom control that inherits from the
combobox and listen for a specific message...
Private Const WM_SETFOCUS As Int32 = &H7

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
Select Case m.Msg
Case WM_SETFOCUS
Me.DroppedDown = True
Case Else
' do nothing...
End Select
End Sub
Also maybe Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As Short and check to see if the tab was down...? if so set droppeddown = true

Hope this helps...

Marc Cramer

Peter Stojkovic wrote: VB 7.1 and windows.forms.

I have a comboBox on a form.
When the user goes with TAB-Key to the comboBox,
the comboBox should dropDown the ListBox automatically
and show ALL entries.
The user has no possibility to use a mouse !!

How can I program a automatic dropDown ( Showing all entries ),
if the user tabs to the comboBox ???
Thanks
for any help
Peter

Nov 21 '05 #2

P: n/a
Another option: Have SendKeys.Send ("{F4}") on the GotFocus event of the
dropdown.

"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:ut**************@TK2MSFTNGP12.phx.gbl...
VB 7.1 and windows.forms.

I have a comboBox on a form.
When the user goes with TAB-Key to the comboBox,
the comboBox should dropDown the ListBox automatically
and show ALL entries.
The user has no possibility to use a mouse !!

How can I program a automatic dropDown ( Showing all entries ),
if the user tabs to the comboBox ???
Thanks
for any help
Peter


Nov 21 '05 #3

P: n/a
Yet another option: Have ComboBox.DroppedDown = True in the GotFocus event
of that combo box.

"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:ut**************@TK2MSFTNGP12.phx.gbl...
VB 7.1 and windows.forms.

I have a comboBox on a form.
When the user goes with TAB-Key to the comboBox,
the comboBox should dropDown the ListBox automatically
and show ALL entries.
The user has no possibility to use a mouse !!

How can I program a automatic dropDown ( Showing all entries ),
if the user tabs to the comboBox ???
Thanks
for any help
Peter


Nov 21 '05 #4

P: n/a
Peter,

Very quick and dirty
\\\
Private Sub ComboBox1_Enter(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles ComboBox1.Enter
ComboBox1.DropDownStyle = ComboBoxStyle.Simple
Me.ComboBox1.Size = New System.Drawing.Size(160, 152)
'size as you wish
End Sub
Private Sub ComboBox1_Leave(ByVal sender As Object, ByVal e _
As System.EventArgs) Handles ComboBox1.Leave
ComboBox1.DropDownStyle = ComboBoxStyle.DropDown
Me.TextBox1.Focus() 'Next control or a nicer way
End Sub
///
I hope this helps?

Cor

"Peter Stojkovic" <Pe*************@gmx.net>
VB 7.1 and windows.forms.

I have a comboBox on a form.
When the user goes with TAB-Key to the comboBox,
the comboBox should dropDown the ListBox automatically
and show ALL entries.
The user has no possibility to use a mouse !!

How can I program a automatic dropDown ( Showing all entries ),
if the user tabs to the comboBox ???
Thanks
for any help
Peter

Nov 21 '05 #5

P: n/a
"Peter Stojkovic" <Pe*************@gmx.net> schrieb:
How can I program a automatic dropDown ( Showing all entries ),
if the user tabs to the comboBox ???


Add a handler to the control's 'Enter' event and set its 'DroppedDown'
property to 'True' there.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.