Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

ComboBox DropDown Orientation

Somebody has a clue on how can I set the dropdown orientation of a ComboBox ?
I just can't find any API that does that and Comboboxes do not have any Align Property.
It's just because when my ChildForm is maximised, I have some ComboBoxes at the far right and when dropped, we just can't access the sliders...

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
DropDown Orientation
Is there really no property or API that allows us to choose if the dropdown of a combobox is left, center or right justify ???

Dropdown Combobox
I have comboboxes appearing highlighted when I don't want them to - I'm initialising them and disabling them prior to the user hitting an update ket to enter data. For some reason they all appear highlighted until the data has been entered and they are disabled again.

VB6 Combobox DropDown
I am trying to make some comboboxes that when i type in the text field, will drop down and automatically and find first name on the list fitting to my type in.

Ex. i got a combobox and in the text field i write dr. now i want the combobox to show the list with items, and automatically select the item named drums, and show it in the text field. i've done this in a VBA program i made for a word document as shown on picture.


i've written "it" and rest happened by itself.

Is it possible to do this in VB6 comboboxes?

Aut. Dropdown A Combobox
How can I make a combobox drop down using code?

DropDown The Combobox
Does anybody know how to DropDown the combobox (style 2)

when i say: Combobox.setfocus

did cost me 440 minutes to figure out, still didn't find it yet.

Hope you can help me out.


Combobox Dropdown

I seem to remember a function or API that automatically drops down a combobox when someone starts typing and then matches the string from the text portion with the text from the list portion.  Does anyone know this code or where to find it?



Ron Repp

Combobox Dropdown Problem
First of all let me thank everyone who has responded to my initial post about comboboxes. You response were much appriciated so thank you all very much. Now there is another combobox problem that I am having in respects to when you click on the combobox and the list is condensed but when you click on the combobox again the list expands. I know there is something simple I am missing in order to fix it. I am controlling the values of the combobox through the getfocus option of the combobox. Let me know what you all think. Again thank you all so much for all your help.

Combobox Dropdown With Checkbox
Can someone give me an idea on how to go about creating a Combobox that is populated with data AND a checkbox corresponding to each item.
Eg: A combobox is populated with the items "A","B" and "C". Clicking the combo box brings a drop-down menu that lists A, B, and C and 3 checkboxes (one for each item).



Automatic Dropdown Of Combobox
I am using vb6 and have incorporated the autocomplete feature for the combobox successfully. I would like to have the combobox dropdown its list of choices when the focus is set but cannot find any procedures for this. Any help would be appreciated.


ComboBox Dropdown On GotFocus ?
Hey, anyone know how to make a combobox dropdown when it is tabbed to? Many thanks.

Combobox && Dropdown Width
Can I master the dropdown zone width, it does not seem to depend on combobox with ...
What does it depend on actually ??

Combobox Dropdown UPPERCASE
i've been looking for this problem for a while can anybody help me how to code the combobox so that the letter will be an upper case when user key in the letter in combobox and how to sort items i combo box.

Combobox Dropdown Problem.
hi,i have another question regarding combobox.when i dropdown combobox each time have repeat value to solve this problem?

this is the current code:

Private Sub Combotimet_DropDown()
Dim strSQL As String
Dim conDataConnection As Connection
Dim Workday As String
Dim Shift As String
Dim rs2 As ADODB.Recordset
Dim rs1 As ADODB.Recordset

Workday = Combocategory.Text
Shift = txtshift.Text

Set conDataConnection = New Connection
conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
"Overtime.mdb;Persist Security Info=False"

Set rs = New ADODB.Recordset
strSQL = "select * from [Employee]" & vbCrLf & _
"where ([Department] in (" & vbCrLf & _
" select [DepartmentName] from [Department]" & vbCrLf & _
" where [Id] in (" & vbCrLf & _
" select [DepartmentID] from [UserDepartment]" & vbCrLf & _
" where [UserId] = '" & gUserId & "'" & vbCrLf & _
" ))" & vbCrLf & _
") or exists(SELECT * FROM UserRoles WHERE [UserId] = " & gUserId & _
" and [RoleId] in (select [Id] from [Roles] where [RoleName] in ('admin','guest')))"
rs.Open strSQL, conDataConnection, adOpenStatic, adLockOptimistic

Set rs2 = OpenRecordset("select distinct TimeTo from Wd where WorkDay ='" & Workday & "' and Shift ='" & Shift & "'", adOpenStatic, adLockReadOnly)
While Not rs2.EOF
Combotimet.AddItem rs2!TimeTo & ""
Set rs2 = Nothing
End Sub

Combobox - Dropdown List Changes???

Try this. Add the following code to a form that has a combo box on it and runs the following code on load up.

VB Code:
me.cbobox1.additem "apple"me.cbobox1.additem "banana"me.cbobox1.additem "coconut"

Then, Using the Textchanged property do this

VB Code:
me.cbobox1.clearme.cbobox1.additem "Test"

Run your program, click the down arrow for the combo box and then type in the text box.

Question: Does the list box surround that dropdown still remain and refreshed?

If it did then do you know how to remove this, is it redraw?


Combobox Dropdown Like In Browser
hi... can someone help me abt combo box, i want it like in internet browser address bar, when you type something like for example, you type "w" then all address that you've type previously will show in a dropdown list. Thanx!

Combobox Key Value Without Dropdown **Resolved**
After I load values into a combobox and then select the value via code. When I want to use the key value of the combobox I have to click on it's dropdown arrow first before I am able to access it. Is there a way to simulate a dropdown event or is there a better way of doing this? Here is my code:

VB Code:
Option Explicit Private Sub Form_Load()    Me.Combo1.AddItem "Adam"    Me.Combo1.ItemData(Combo1.NewIndex) = 1        Me.Combo1.AddItem "Boy"    Me.Combo1.ItemData(Combo1.NewIndex) = 2    Me.Combo1.AddItem "Charlie"    Me.Combo1.ItemData(Combo1.NewIndex) = 3    Me.Combo1.AddItem "David"    Me.Combo1.ItemData(Combo1.NewIndex) = 4    Me.Combo1.AddItem "Edward"    Me.Combo1.ItemData(Combo1.NewIndex) = 5        Me.Combo1.Text = "David"End Sub Private Sub Command1_Click()    MsgBox Me.Combo1.ItemData(Me.Combo1.ListIndex)End Sub

I have combo1 Style property set to 0 - DropDown Combo.

**Update when I set combo1 Style property to 2 - DropDown List the code works without an error but I prefer to use the DropDown Combo Style.

If I click Command1 without first clicking on combo1's dropdown arrow I get a Run time error 381 Invalid Property Array Index.


Combobox/Dropdown Calendar
Anyone know where I can get a good drop-down calendar control? Thanks.


ComboBox DropDown Size
I am using VB6. Following is the procedures in the MSDN that tells how to change the size of the dropdown area of a ComboBox. However, it does not seem to work. Does anyone know if I need to add a reference or somehow set something to get this to work?????

To set the size of the combo box drop-down area

Click the drop-down arrow at the right of the combo box.
The outline of the control changes to show the size of the combo box with the drop-down area extended.

Use the bottom sizing handle to change the initial size of the drop-down area.

Click the drop-down arrow again to close the drop-down portion of the combo box.

Id Item In DropDown ComboBox
Hi there, in my form, i have a dropdown menu which is filled with data from a database (in a recordset), i have an employee name field and an id employee field. I want to show the employee's name in the dropdown and take the employee's id that is selected, i've shown the name, but i can't figure out how to link the employee's id in the same drodown control, in web you can do this without any problem, i guess the same could be done in VB, but how? Any ideas?

Thanks in advance.

Combobox Dropdown Height
Hey guys,

Is it possible to control the size of the dropdown menu? I think .net has the dropdownheight option but I'm not sure if VB has that capability.

I want to increase the height because the list could have more than 100 options and scrolling down through all of it may be a bit tiresome.


Dropdown Combobox Help Pleaseeeeeeee?
I have created a combobox in my form with the databases text fields. I did nothing to the combobox yet except have it dropdown into a list ie. item1, item2. On each account I have, I would like it to save the combobox option within each account. I have to keep reseting it and it will not save on the rest of the form.. Can someone please bail me out? Keep in mind, I'm a beginner with VB. details would be helpful.


Shifting Dropdown Of A Combobox
I am trying to change the postion of the dropdown window of the combobox.

function GetComboBoxInfo gives me the handler to this dropdown window

then i am using SetWindowPos to set the new postion of the window , but immediately it returns to its orignal position as the system takes over .

Do I have to do subclassing ?

Any Suggestions..



CInfo.cbSize = Len(CInfo)

GetComboBoxInfo Combo1.hwnd, CInfo

Dim list_hwnd As Long

list_hwnd = CInfo.hwndList

Dim cntrl_rect As RECT
GetWindowRect Combo1.hwnd, cntrl_rect

Dim result As Long

result = SetWindowPos(list_hwnd, -1, cntrl_rect.Left-10, cntrl_rect.Top, (cntrl_rect.Right - cntrl_rect.Left) , _
cntrl_rect.Bottom - cntrl_rect.Top, SWP_SHOWWINDOW)

ComboBox Dropdown Event
Hi folks!

I was creating a personalized browser for myself in VB, when i ran realized that I could not eliminate duplicate values in the dropdown list of the address bar of my browser that I am creating. For example, i go to, it is added in to dropdown list but if i type it again, it shows up twice! I just want to be able to show it once since it is the same value!

Any help is much appreciated : )

|Buy low - hold - prosper|

Increase Width Of Only The Dropdown In A Combobox
I have a combox which has to have fixed width due to certain space constraints. But however, there are certain items in the combobox list, which do not fit in the width of the combobox. So when I click on the down arrow button, I do not see the entire text of a few items.

Now my requirment is that I should increase the width of only the dropdown list part so that I can see the entire text of even the lengthiest item.This should behave similar to the styles dropdown in Microsoft Word which increases in width to accomadate the lengthiest style item. In fact this combox control is added to a customized toolbar in a word application.

Thanks & Regards
Vikram D Bennur

How To Resize A Dropdown Width In A Combobox

I am having some problems with a combobox with dropdownlist property, i want to resize only the dropdown list not the combo, but i don't figure how can i do it, can you help me please?

Selecting Text In A Dropdown ComboBox
I have a combo box filled with varying numbers for a GoTo Page procedure. When a user enters the wrong thing, I want to highlight the entry so they see what they did wrong but they can also can just type over it. When I use ComboBoxName.SelStart and ComboBox.SelLength, VB dies not object. When I add ComboBox.SelText, it tells me it's an "Invalid Use of Property" and goes on to explain that "You are trying to write to a property that is read-only."

Huh? It's a legitimate property for this Combo Box (Style is set to 0--Dropdown Combo)--shows up after the dot and everything.

Got clues?


Who lives to be a gramma (Nana Mouse)

Combobox - Enlarge Dropdown Area
Is it possible to make the dropdown area of a combobox larger through some property? I am not trying to change the size of the combobox. I am trying to change the size of its dropdown box. Currently I have a combobox with #s 1-14. When you click the arrow to show the dropdown list, it will show #s 1-8. You have to scroll if you want to see the next #s. I find this a bit annoying since the program's is large enough to show the whole contents of the combobox but it doesn't and I have to scroll. I tried integral height but that didn't do anything.

Prevent Combobox Dropdown When Locked
How can I prevent the Combobox's Dropdown when the combobox's Lock Property is set to True? I don't want to set Enable to False because I want the ForeColor to appear in Blue.



Shifting Dropdown Of A Combobox ( Resolved)
I am trying to change the postion of the dropdown window of the combobox.

function GetComboBoxInfo gives me the handler to this dropdown window

then i am using SetWindowPos to set the new postion of the window , but immediately it returns to its orignal position as the system takes over .

Do I have to do subclassing ?

Any Suggestions..



CInfo.cbSize = Len(CInfo)

GetComboBoxInfo Combo1.hwnd, CInfo

Dim list_hwnd As Long

list_hwnd = CInfo.hwndList

Dim cntrl_rect As RECT
GetWindowRect Combo1.hwnd, cntrl_rect

Dim result As Long

result = SetWindowPos(list_hwnd, -1, cntrl_rect.Left-10, cntrl_rect.Top, (cntrl_rect.Right - cntrl_rect.Left) , _
cntrl_rect.Bottom - cntrl_rect.Top, SWP_SHOWWINDOW)

Combobox - Make Dropdown Longer
I know there is a routine to enable you to override the default drop down part of a combobox.

I have even used it !

Problem is I can't find the prog.

Can someone do me a favour and paste it here ?

Thanks a lot


Multi Columns In Combobox Dropdown
Is it possible to have multiple columns or a grid in the dropdown list of a combobox? If so, please post an example...

Highlighting Combobox Dropdown Entry

Does anyone know how to highlight the matched row in a dropdown combobox after using SendMessage to find the row?

Im typing a letter, sendmessage is finding the row in the combobox and autodropping the combo box list down so u can see the match but it isnt highlighted. Is there a way to do this?

Thanks peeps

Dropdown Combobox...Show More Items?
How do you get a combo box to display more items?
Anyone got the API code for it?

How To Ask The Combobox To Dropdown?And Back To Normal
Lets say i perform
then i want the combobox to automatically dropdown after the XXXXX coding

I also want to put in the
private sub combo1_change

when i change the combo it will dropdown automatically

after that when i press enter key it will go back to normal again.

Automatically Dropdown A Combobox On Autocomplete
I am using the combobox from the Microsoft Forms 2.0 object Library. I am using this because it autocompletes really well. I want my combobox to automatically dropdown on autocomplete or even just on Change. I've read over 50 posts on comboboxes, but still have no answer. Any ideas???

Combobox In Dropdown Mode After Setfocus
if i do a 'setfocus' on a combobox, how can i display this combobox in the drop down mode (the same way like you clicked on the little arrow).

The purpose is the following: the user clicks on an arrow, i position the combobox and then i want it to expand, so that is seems that the arrow was the combobox itself.

any suggestion?

How To Select A Specific Value In Dropdown ComboBox
Hi there, hope you can help, thanks. I have a catalog where i add user's data, in the add form you can choose an employee from a dropdown combobox, when you want to update that record it appears a form with the same fields that in the add form, in the dropdown have to be all the employees existent but the employee related to that user must be selected by default. I'm filling the dropdown with code and when i fill the combo i know the employee's id (the one that is going to be updated) and the "other" employee's id (from the ones that are filling the combo). So i think that in a while not OrsThatFillsdropDown.eof i could compare the id's and when they matches, that record is the selected, any ideas?

Thanks in advance.

How Can You Make A Dropdown ComboBox Non-edittable?
I have a comboBox which will allow the user to select amongst a few different choices, but once a choice is selected/displayed in the main comboBox display part (on the top) then I do not want the user to be able to edit the text which is being displayed (ie: do not let them add letters or delete letters, etc..).

If I mark the comboBox as 'Locked=True' then you can not select anything from the drop down box.
If I mark the comboBox as 'Enabled=False' then you can not click to open the drop down box.

Since it sems I need to keep 'Locked=False' and 'Enabled=True', does anyone have any ideas how to stop a user from being able to manipulate the text in a dropdown comboBox?

I would assume I could redraw the full text I want to be seen everytime a dropdown comboBox Keypress came in, but this would require me to remember the value in which the comboBox was set to before the Keypress ocurred ..... right? This is not a hugh deal, but I was thinking I was just missing some setting or something.

How would you do it?

Edited by - uncletr on 6/27/2004 9:51:03 AM

How Do U Add Text To A DropDown Listbox(combobox)?
Hey , I was wondering how you add text to a DropDown listbox(combobox)?

Lets say u have birthdates u want to add to a combobox. You type the brithday into the textbox and click on a command button which then puts it and stores it into a dropdown list box. If someone could help me i would be greatly appreciated!

Problem: Dropdown Combobox Inside A Grid ?
hey guys i really need some help, im a cute_dumb newby...!

my problem is this..
How a can i make a dropdown box inside a grid, the dropdown box must be populated with a database for example a products_name, when a certain item has been selected it will populate the entire row of that specified grid... and another, is there a custom control for this...? could you share it with me pls....

thanks guys...
looking forward of hearing from you soon....!

Populating ComboBox/DropDown In Visual Basic 6.0
Hey, im kinda stuck completing my project for A level at college, and i would like to know how to populate a ComboBox/Dropdown list in visual basic. I have the data i want (a list of counrties) in an Excel Spreadsheet, but i have no idea what to do to get it displayed in the combo box in VB. I have tried everywhere on the net, and cannot find any suitable topics to aid me in what i would like to knw.

thanks very much for your time

Simulate ComboBox Dropdown Click[solved]
I'm trying to create my own usercontrol, based on a textbox, which should have the combobox-dropdown list. why? becuase from what i know it isn't possible to skin a combobox, which i need to do.

when the user presses the down-button in the textbox, the combo-box dropdown-list should appear below the textbox. does anyone know how to do this?

thanks in advance

Change Event In DropDown List ComboBox
I have two ComboBoxes on a form. They are each Style 2 (DropDown List) because I need the user to select an existing choice in Combo1. Then based on the first choice, Combo2 will be filled with different data. The problem is, if I use Style 2, making a choice in the dropdown list does not fire the Change Event. This seems so simple, yet I have tried all of the logical events and none works the way I want it to. The LostFocus event on Combo1 will only update Combo2 if you move the focus off of Combo1 by clicking Combo2 or another control. Is there an easy way to do this so it immediately updates Combo2 when one of the choices in Combo1 is selected?

Also, if Combo2 is a DropDown List Style, I cannot seem to set which one of the options is the initial text in the ComboBox. It seems to only accept it if Combo2 is a DropDown Combo style that allows manual editing of the text, which I don't want.

Thanks for anyone's help.

Setting Combobox Text When Style = Dropdown List

I have a Combobox (Style = Dropdown List) that is loaded with its items on the form_load event. After the items are loaded, I want to select a specific item from the list. I tried setting the text property to the item I want displayed, but an error is returned "Invalid Property Value." Is there a way to make this work without setting the style property to dropdown combo (I dont want the user to be able to edit the items in the list after they are selected)?

Thanks for any help.

How To Change Text In A Combobox With Prop. Set To Dropdown List
i'm using a combobox - and since i want the user to choose from only the list i loaded to it - i set its prop. to dropdown list.

however, it doesn't serve my purpose for giving it some caption like: -Choose from the list- when i load my form... since the text is read-only..

is there any way i can do this? please? tnx...

Automatically Selecting Text In A ComboBox Dropdown List
I created a combo box with the Dropdown List style property because I essentially want to restrict the user to enter only specified items.

I use the following code to select specific text in a combo box but it seems like there is a better way. This method is slow and you can see the combo box scroll through the items on a slow computer. Any help is appreciated. Thanks in advance for you time!


Public Function GetPC(ByVal strText As String) As Integer

Dim i As Integer

With frmMain.cboPriority
For i = 0 To .ListCount
.ListIndex = i
If .Text = strText Then
GetPC = i
Exit Function
End If
Next i
End With

End Function

I use the following code to call this function...


cboPriority.ListIndex = GetPC(rstAccounts!PC)

I tried to write to the .Text property of the list box hoping that it would select the item matching the text I specify but it gives me a run-time error. I found that I can only read the .Text propery at run-time when the Dropdown list style is used.


VB 6.0. ComboBox Type 2 (DropDown List). No Change Event???
VB 6.0. ComboBox type 2 (DropDown List). While change selection the Change event do not queried!!!

Looking in MSDN shows that problem is known only for FoxPro 6.0... without solution.

Is that problem solveable or not? It's not good use Validate. Validate is performed only when focus goes to another control, but I need to perform action both when focus is lost and when focus is kept...

Edited by - Akina on 12/14/2002 2:00:17 AM

How To Make Combobox Dropdown Style Simple To Readonly
Hi is any ideas how to make the combobox dropdown style= simple to read only?


Changing Selected Value Of A Dropdown ComboBox Via A Text String?
Lets say I have a dropdown comboBox which is populated with the following values:


If the current selected value is THREE, then would it be possible to change which value is the selected value based on a text string instead of an index.

I tried doing the following, but it gave me an error. It seems like it should I doing something wrong?

    textStr = "FOUR"
    myComboBox.SelText = textStr

Edited by - uncletr on 7/1/2004 10:24:05 AM

Copyright 2005-08, All rights reserved