18
[email protected] Electro-Team Interesting Education

Combo box

Embed Size (px)

Citation preview

[email protected]

Electro-TeamInteresting Education

ComboBox

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

Open new project

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

Add items from Design window

Run Time

You can add same items at run-time

Another method for adding items

Add items by Code

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

If there is no selected item ComboBox1.SelectedIndex will be

-1 and this will produce an Error

ComboBox1.Items

White

Red

Black

yellow

ComboBox1.SelectedIndex

0

1

2

3

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

The End

Produced by

Electro-Team