473,387 Members | 1,669 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,387 software developers and data experts.

combobox down list

142 100+
can anybody tell me what is the code to show the drop down list in combobox when press the down arrow in the keyboard? i am using VB6.
Feb 28 '07 #1
6 1890
Killer42
8,435 Expert 8TB
can anybody tell me what is the code to show the drop down list in combobox when press the down arrow in the keyboard? i am using VB6.
Well, this sort of works, except that the list disappears again when you try to scroll down it. Might be a place to start, though.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  2.   If KeyCode = vbKeyDown Then
  3.     Beep
  4.     KeyCode = vbKeyF4
  5.   End If
  6. End Sub
Mar 1 '07 #2
This is not a good practice. Use this code on the gotfocus event this will be better
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_GotFocus()
  2. SendKeys "{F4}": DoEvents
  3. End Sub
Mar 1 '07 #3
joemo2003
142 100+
the list do scroll down, but it can not select item when press the down key. how to make it press the downkey one time is scroll down the list, and press again then move the selection in the combobox? just like the google toolbar.

thanks

Well, this sort of works, except that the list disappears again when you try to scroll down it. Might be a place to start, though.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  2.   If KeyCode = vbKeyDown Then
  3.     Beep
  4.     KeyCode = vbKeyF4
  5.   End If
  6. End Sub
Mar 1 '07 #4
Killer42
8,435 Expert 8TB
the list do scroll down, but it can not select item when press the down key.
Well, that's what I said. I just threw that together to provide you something to work with. It's certainly not a complete solution.

The alternative suggested by sukeshchand may be a much better way to go.

The real problem with using the down arrow to open the list is that you have to be able to tell whether the list is currently displayed or not. One possibility would be to set a flag in the GotFocus event, then only do the "drop-down on down arrow" the first time the key is pressed. But this is only a small improvement, as you still couldn't tell for sure whether you would be opening or closing the list.
Mar 1 '07 #5
Try to do like this
Here i am not recomented to use this because this is not a proper way to do that.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  2. If KeyCode = vbKeyDown Then
  3.     KeyCode = 0
  4.     DoEvents
  5.     SendKeys "{escape}"
  6.     DoEvents
  7.     SendKeys "{f4}"
  8.     DoEvents
  9.     KeyCode = vbKeyDown
  10.     DoEvents
  11. End If
  12. End Sub
Mar 3 '07 #6
joemo2003
142 100+
Thanks a lot



Try to do like this
Here i am not recomented to use this because this is not a proper way to do that.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  2. If KeyCode = vbKeyDown Then
  3.     KeyCode = 0
  4.     DoEvents
  5.     SendKeys "{escape}"
  6.     DoEvents
  7.     SendKeys "{f4}"
  8.     DoEvents
  9.     KeyCode = vbKeyDown
  10.     DoEvents
  11. End If
  12. End Sub
Mar 3 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
2
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
0
by: TD | last post by:
I have a combobox that is sometimes slow to drop down when clicked on. If you select an item in the list that is near the top of the list then the next time you click on the combobox it drops down...
0
by: TD | last post by:
I have a combobox that is sometimes slow to drop down when clicked on. If you select an item in the list that is near the top of the list then the next time you click on the combobox it drops down...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.