Home > DeveloperSection > Articles > ComboBox Control in VB.Net

ComboBox Control in VB.Net

Posted by  Pushpendra Singh
on    December-13-2010 20:55 PM

VB.Net VB.Net 
0 Comment(s)
 7477  View(s)
Rate this:

ComboBox Control in VB.Net

ComboBox is a combination of a TextBox and a ListBox.

How use the ComboBox Control

Drag and drop ComboBox from toolbox on window Form.


ComboBox Control in VB.Net


'Here Item is added in combobox on form load

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load       

        ComboBox1.Items.Add("C#")'Add the First item in ComboBox




    End Sub

'Here show the selected item in Label2 on ComboBox SelectedIndexChanged event


    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

        ' Assign the selected item in label

        Label2.Text = "You selected " + ComboBox1.SelectedItem

    End Sub



In above code Item is added dynamically so all Item in ComboBox1  will show at run time.


Run the project


ComboBox Control in VB.Net

When you select the given option then SelectedIndexChanged event will fire and selected item will show in the messagebox.


ComboBox Control in VB.Net


How set the AutoCompleteSource Properties

Choose AutoCompleteSource property of ComboBox is ListItem and also set AutoCompleteMode to suggest, append, or SuggestAppend.

ComboBox Control in VB.Net

When you type any text in the ComboBox then it searches the related item and if related item is available then it suggest the related item.

ComboBox Control in VB.Net

Recent Activities

ashish srivastava added new Article Article Submission Process   2 days ago

Tarun Kumar added new Question What is dot notation?   3 days ago

Manoj Pandey added new Blog Android Studio Vs Eclipse   6 days ago

Don't want to miss updates? Please click the below button!