Library articles and tutorials
Combo Box
By James Crowley, published on 14 Jul 2001
Styles
A combo box has three different styles:
0 - Dropdown Combo
1 - Simple Combo
2 - Dropdown List
Style 0 allows the user to either select an item on the dropdown list, or
enter their own value.
Style 1 allows the user to either select an item on the dropdown list, or
enter their own value. However it looks more like a combination of a text box and list
box.
Style 2 only allows the user to select an item on the dropdown list
Related articles
Related discussion
-
ditto
by zapthedingbat (2 replies)
-
Mousewheel
by jonh (3 replies)
-
True multithread VB source code controls
by James Crowley (3 replies)
-
Rely
by Yujvendra Verma (4 replies)
-
True multithread VB source code controls
by James Crowley (3 replies)
Try this:
ComboBox1.Items.Add("Text")
It's pretty flexible, you can put just about anything in there:
ComboBox1.Items.Add("Text" & RichTextBox1.Text & someVariable & etc.)
- Vincent
The .AddItem is to add items to the Combo Box at run time. This is normally the preferred way of doing this instead of doing it through the properties of the Combo Box.
Usage:
Combo1.AddItem "String"
Yeah, I was getting an error like "Invalid procedure call or argument" (Runtime error 5). It seems to work if I remove the index # (rather than Combo1.Additem "Blah" 2, just Combo1.Additem "Blah").
Combo1.AddItem tells me that it's a wrong code.