473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ComboBox and automatic dropDown

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
5 7035
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jean | last post by:
hi: i am developing a custom combobox for my company's needs that is made up of a textbox, listbox, button. i am using c#. everything is fine except for one issue. in a normal combobox,...
7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
7
by: NCrum | last post by:
I want to set the Default value of a Combobox for any changeable record and have got this working but it is totaly unsatisfactory see the code below I loop through the items in the Combo looking...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
1
by: Norm Katz | last post by:
When you use a bound combobox and you set its dropdown style to "dropdown" that allows you to enter text in the edit box. But if you enter anything other than a value in the current bound items...
0
by: Mike | last post by:
Hi all! I have an OwnerDrawVariable ComboBox in .net. In the ComboBox DropDown event I display another control - works well. In the control's Leave event I remove the control - works well. So...
4
by: Kalvin | last post by:
I have seen this question raised, but I cannot find an answer. I have an MDI app, when I load an child form with a combobox being bound in the load event, it won't allow me to set selectedindex =...
5
by: Gil | last post by:
Is there a way to tell if a combbox is in dropdown mode. I tried and if statement combobox.dropdown = true but i get an error. dropwndown function doesnt store if its true or false what i am...
1
by: amber | last post by:
I'm having an issue with a combobox that is making no sense to me at all. I have a form with several comboboxes/textboxes. The values in these boxes are based on a datarowview, which is based on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.