+ All documents
Home > Documents > Visual Basic Tool Box Control 1 Content of LAB 2

Visual Basic Tool Box Control 1 Content of LAB 2

Date post: 22-Nov-2023
Category:
Upload: independent
View: 0 times
Download: 0 times
Share this document with a friend
20
Visual Basic Tool Box Control 1 Eng.Ragwa Badr & Eng. Hala Nageh
Transcript

Visual Basic

Tool Box Control

1

Eng.Ragwa Badr & Eng. Hala Nageh

Content of LAB 2Radio Button

Examples

Check Boxes

Examples

Combo Box

Combo Box Style

List Box

Examples

Picture Boxes

2

Eng.Ragwa Badr & Eng. Hala Nageh

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

3

Eng.Ragwa Badr & Eng. Hala Nageh

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

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 :

4

Eng.Ragwa Badr & Eng. Hala Nageh

Design a simply calculator but using four Radio Button

Code :

5

Eng.Ragwa Badr & Eng. Hala Nageh

Design application when the user choose the number of department , text box show the name of department

Code :

6

Eng.Ragwa Badr & Eng. Hala Nageh

Design application to make user choose from the radio button as the following

Code :

7

Eng.Ragwa Badr & Eng. Hala Nageh

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.

8

Eng.Ragwa Badr & Eng. Hala Nageh

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

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

9

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

10

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

11

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

portionEng.Ragwa Badr & Eng. Hala Nageh

12

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

13

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

14

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

15

Design application for add, remove and clear item to

combo box

Code :

Eng.Ragwa Badr & Eng. Hala Nageh

16

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

Eng.Ragwa Badr & Eng. Hala Nageh

17

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

Design the following application

Eng.Ragwa Badr & Eng. Hala Nageh

18

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 size to maintain the size ratio.

Eng.Ragwa Badr & Eng. Hala Nageh

19

Design application to show picture

Eng.Ragwa Badr & Eng. Hala Nageh

20


Recommended