VB6 Tutorial 42: The Combobox

Posted On 2018-04-27 by VB6Boy
Keywords:
Tags: VB6 Tutorials 
Views: 51

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


Looking for the more of the VB6 Tutorial? Here is the tutorial index.

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

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.

Looking for the more of the VB6 Tutorial? Here is the tutorial index.


About the Author

has posted a total of 78 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.166.212.152

Before you can post, you need to prove you are human. If you log in, this test goes away.


Code Links