You are on page 1of 20

1

Visual Basic
Tool Box Control

Eng.Ragwa Badr & Eng. Hala Nageh


Content of LAB 2
Radio Button

Examples

Check Boxes

Examples

Combo Box

2 Combo Box Style

List Box

Examples
Eng.Ragwa Badr & Eng. Hala Nageh

Picture Boxes
3

 Used only as a group of buttons. When the user selects


one of them the others are deselected automatically
 Note : All other properties of this control are similar to those
in form and command button where they are fully discussed
which are caption, font, enabled, back color and visible
beside an important property which is value that takes true
or false
Property name objective
Checked indicate whether the radio button is selected or
unselected
Font specify the font to use for text
Name give the radio button a meaningful name
Text specify the text that appears inside the radio button

Eng.Ragwa Badr & Eng. Hala Nageh


4

 Design a form with three option buttons " red ", " green "
and " blue “ such that when we click on options the
color of the form colored by red, green and blue
respectively.
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


5

 Design a simply calculator but using four Radio


Button
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


6

 Design application when the user choose the number of


department , text box show the name of department
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


7

 Design application to make user choose from the radio


button as the following
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


8

 The Check Box control is similar to the Radio Button ,


except that a list of choices can be made using
check boxes where you cannot choose more than
one selection using an Option Button.
 the Check Box is checked, its value is set to 1 and
when it is unchecked, the value is set to 0.
Property name objective
Checked indicate whether the check box is selected or
unselected
Font specify the font to use for text
Name give the check box a meaningful name
Tab Index indicate the position of the check box in the Tab
order
Text specify the text that appears inside the check box

Eng.Ragwa Badr & Eng. Hala Nageh


9

 Design the form with label and check box , when


the user check on box write check or uncheck on
label
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


10

 Design the form with button (enabled = false) and


check box , when the user check on box the button
is enabled
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


11

 Design form with four label (visible = false) and four


check box , when the check the box the label is visible
in Respectively
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


12

 A Combo Box enables the user to select either by


typing text into the Combo Box or by selecting an item
from the list.

Property name objective


Drop Down Style indicate the style of the combo box
Font specify the font to use for text
Name give the combo box a meaningful name
Selected Index get or set the index of the selected item
Selected Item get or set the value of the selected item
Sorted specify whether the items in the list portion
are sorted
Tab Index indicate the position of the combo box in
the Tab order
Text get or set the value that appears in the text
Eng.Ragwa Badr & Eng. Hala Nageh

portion
13

 There are three types of Combo Box styles :


1. Dropdown Combo (style 0)
 The Dropdown Combo box first appears as only an edit area
with a down arrow button at the right .The list portion stays
hidden until the user clicks the down-arrow button to drop
down the list portion .The user can either select a value
from the list or type a value in the edit area.

Eng.Ragwa Badr & Eng. Hala Nageh


14

2. Simple Combo (style 1)


 The Simple Combo box displays an edit area with an
attached list box always visible immediately below the edit
area. A simple combo box displays the contents of its list all the
time.The user can select an item from the list or type an item in
the edit box portion of the combo box. A scroll bar is displayed
beside the list if there are too many items to be displayed in
the list box area.

Eng.Ragwa Badr & Eng. Hala Nageh


15

3. Dropdown List (style 2)


 The Dropdown list combo box turns the combo box into a
Dropdown list box. At run time , the control looks like the Dropdown
combo box.The user could click the down arrow to view the list.The
difference between Dropdown combo & Dropdown list combo is
that the edit area in the Dropdown list combo is disabled.The user
can only select an item and cannot type anything in the edit area.
Anyway this area displays the selected item.

Eng.Ragwa Badr & Eng. Hala Nageh


16

 Design application for add, remove and clear item to


combo box
 Code :

Eng.Ragwa Badr & Eng. Hala Nageh


17

 List Box is to present a list of items . The user can


click and select items from this list. In order to add
items to it or remove item from it
Property name objective
Font specify the font to use for text
Name give the list box a meaningful name
Selected Index get or set the index of the selected item
Selected Item get or set the value of the selected item
Selection Mode indicate whether the user can select zero
choices, one choice, or more
than one choice
Sorted specify whether the items in the list are
sorted
Eng.Ragwa Badr & Eng. Hala Nageh
18

 Design the following application

Eng.Ragwa Badr & Eng. Hala Nageh


19

 The picture box allows you to place graphics information


on a form. It is best suited for dynamic environments - for
example, when doing animation.
Property name objective
Image specify the image to display
Name give the picture box a meaningful name
Size Mode Determines the size of the image to be displayed in the
control. This property takes its value from the Picture Box
Size Mode enumeration, which has values:
Normal - the upper left corner of the image is
placed at upper left part of the picture box
Stretch Image - allows stretching of the image
Auto Size - allows resizing the picture box to the size
of the image
Center Image - allows centering the image in the
picture box
Zoom - allows increasing or decreasing the image
Eng.Ragwa Badr & Eng. Hala Nageh

size to maintain the size ratio.


20

 Design application to show picture

Eng.Ragwa Badr & Eng. Hala Nageh

You might also like