VB6 Tutorial 42: The Combobox
In this lesson, I'll tell you about the ComboBox control in brief.
ComboBox is the combination of a TextBox and a ListBox. The user can type in the text field to select an item or select an item manually from the list. All the properties, events and methods of a ComboBox control are as same as the ListBox control. So the discussion of ListBox control in previous lessons also applies for ComboBox control.
Styles of ComboBox
There are three styles of ComboBox controls-- Dropdown Combo, Simple Combo and Dropdown List. You can change/select the style from the Style property of ComboBox.
Example
ComboBox program to select an item from the list
Private Sub cmdSelectBirthYear_Click() Print "Your year of birth is" & cboBirthYear.Text End Sub Private Sub Form_Load() For i = 1980 To 2012 cboBirthYear.AddItem Str(i) 'Str function returns the 'string representation of a number i = Val(i) Next i End Sub
See the attached example combobox.zip to examine the code in your own IDE.
About this post
Posted: 2018-04-27
By: vb6boy
Viewed: 1,284 times
Categories
Attachments
combobox.zip
Posted: 4/27/2018 2:23:22 PM
Size: 1,937 bytes
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.