Search Tools Links Login

VB6 Tutorial 42: The Combobox

Posted: 2018-04-27
By: vb6boy
Viewed: 885

Filed Under:

VB6 Tutorials

Title Uploaded Size 4/27/2018 2:23:22 PM 1,937

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.

Three type of combobox


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 to examine the code in your own IDE.

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.