Check boxes, radio button MsgBox, Input Box FunctionsMsgBox, Input Box Functions
Lab 3
Ismail M. Romi: PPU- IT Dept
Check Box
Allows the user to select or deselect one or more items in any group
Checked propertyChecked = TrueUnchecked = False
Text property for the text you want to appear next to the box
Radio ButtonA control used to permit the selection of one option from
several choicesRadio buttons appears in groups ( two or more) to
represent mutually exclusive choices (one button in the group always selected)
Radio buttons can be grouped by placing them in a frameChecked property:
Selected = True / Unselected = FalseText property
What is displayed next to the radio button
Group Box
Used as containers for other controls such as radio buttons and check boxes
Improves readability of form by separating the controls into logical groups
Borders and Styles
Most controls can appear to be three-dimensional or flat
Labels, text boxes, and pictures boxes all have a BorderStyle property with different style choices including:NoneFixedSingleFixed3D properties can be changed to the style of
choosing
Setting the Form's Screen Location
You can set the form’s screen position by setting the StartPositionproperty of the form
To center a form on the user’s screen, set the StartPosition property to CenterScreen
MsgBox() FunctionMsgBox() Function
A function that produces a message box.Message Box:
A small dialog box used for output during a program’s execution.
Syntax
IntResponse=MsgBox(“prompt”[, Buttons] [,Title]
IntResponse: Integer return value from MsgBox function (1: OK, 2: Cancel, 3: Abort, 4: Retry, 5:Ignore, 6:Yes, 7: No)
InputBox( ) Function
A message box with a field, in which the user can type a value.
Syntax:Var = InputBox(prompt [,MsgBoxTitle][,Title]
[,DefaultVal][,Xpos][,Ypos])Example:stdName = InputBox("enter student name", "student
record", "ali", 100, 200)
Creating ToolTips
Small label that is displayed when user pauses mouse pointer over a controlAdd a ToolTip Control to Form The new control appears in a new pane, Component Tray that
opens at the bottom of the Form DesignerAfter you add the component to your form, each of the form’s
controls has a new propertySelect ToolTip on ToolTip1 property of each control and add
Tool Tip comments
Changing the Color of Text
ForeColor and BackColor PropertiesUse VB Color Constants from the Color ClassType the keyword Color and a period in the
editor to view a full color list
nameTextBox.ForeColor = Color.RedmessageLabel.ForeColor = Color.White
Lab Training
Questions:You have the following data for student record:Student number, Student name, Major (IS, IT,
Graphics), Courses: (Arabic: 2 credit hours, English 3 credit hours, VB: 3 credit hours).
Design a VB project to accept student data and grades, then calculate the average.
Notes:- After calculation, prevent any change to the entered data. - Use msgbox function and input box function where
required.