You are on page 1of 18

Interesting Education

Electro-Team

Electroteam__@hotmail.com

ComboBox
A ComboBox control is a combination of a TextBox and a ListBox control

Open new project

Add items from Design window

Add ComboBox \ Item property \ press ... Button \ type White, Red, Black & Yellow

Run Time

You can add same items at run-time

Add items by Code

Another method for adding items

Add 1 Button and Fix it

Run Time

Sb could be anything else like X, Y or Z

Add another Button and Fix it

Run Time

Double click on Button2 and type yellow phrase

Add GroupBox, Button and TextBox

Run Time

TextBox Will have the same value as ComboBox

Error
Dim X As String =ComboBox1.Items(ComboBox1.SelectedIndex)
TextBox1.Text = X

ComboBox1.Items ComboBox1.SelectedIndex White 0 Red 1 Black 2 yellow 3 If there is no selected item ComboBox1.SelectedIndex will

be -1 and this will produce an Error

Produced by

Electro-Team

Electroteam__@hotmail.com