Adding items to a combo box control in Microsoft Visual Basic .NET (VB.NET) can cost you time if you don't know how to accomplish the task. A combo box control is a combination of a text box and a list box that provides options for the user to select. A user can either enter data in the text box or choose an item from the list. VB.NET is an object-oriented programming language used to create desktop, phone and web applications quickly.
- Skill level:
Other People Are Reading
Things you need
- Microsoft Visual Basic Express
Start Microsoft Visual Basic Express, click "New Project..." on the left pane of your screen, then select "Windows Forms Application." Click "OK."
Double-click "Button" on the "Toolbox" pane to add a new button control. Double-click "ComboBox" to add a combo box control.
Double-click "Button1" to open the "Form1.vb" module. Press "Ctrl" + "A," then press "Delete" to remove all existing code.
Copy and paste the following code to your "Form1.vb" module:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ComboBox1.Items.Add("Item") ComboBox1.Items.Add("Item") ComboBox1.Items.Add("Item") ComboBox1.Items.Add("Item") ComboBox1.Items.Add("Item") ComboBox1.Text = ComboBox1.Items(0).ToString End Sub
Press "F5" to load items to the combo box control.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for