473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7049
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 GetAsyncKeyStat e 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******** ******@TK2MSFTN GP12.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.Droppe dDown = True in the GotFocus event
of that combo box.

"Peter Stojkovic" <Pe************ *@gmx.net> wrote in message
news:ut******** ******@TK2MSFTN GP12.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.EventArg s) Handles ComboBox1.Enter
ComboBox1.DropD ownStyle = ComboBoxStyle.S imple
Me.ComboBox1.Si ze = New System.Drawing. Size(160, 152)
'size as you wish
End Sub
Private Sub ComboBox1_Leave (ByVal sender As Object, ByVal e _
As System.EventArg s) Handles ComboBox1.Leave
ComboBox1.DropD ownStyle = ComboBoxStyle.D ropDown
Me.TextBox1.Foc us() '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
2050
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, when the dropdown is visible and the user clicks anywhere else, the dropdown gets hidden. i am trying to replicate this behavior and have tried using...
7
8495
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 of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products...
7
23522
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 for a match between cVal and the selectedValue then stop when I do have a match the obvious problem is that each iteration fires the...
2
4325
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 how to use this code? please help! http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
1
2308
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 collection, the .text property does not update. Furthermore, you can't easily trap an event to examine the new value if your program assigns it...
0
1758
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 if you click on the DropDown button the control is displayed. If you click anywhere other than the DropDown button the control is removed. This...
4
2427
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 = -1. If it isn't an mdi child, then there isn't a problem. I have tried setting it to -1 two times. I have tried setting the selecteditem property...
5
10280
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 trying to do is make an autoscroll combobox. like you have on html textbox's, but this time you hit enter for a change to be made. i do this because i...
1
2063
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 a listbox.selecteditem. When a different item is selected in the listbox, all the fields are repopulated with the correct data. I have 1...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.