Professional Documents
Culture Documents
Input Box
Input Box is a function that displays a message
Example :
InputBox Statement
InputBox ( prompt, title )
Example : To display a text box for user to type : InputBox ("Enter your full name", "Supply Name")
Activity 1
Create a program for a user to enter the name, then display the name in a text box. Create a form named frmHello with : - A text box name Text1 - Two command buttons. Caption Input name cmdInput and Quit name cmdQuit.
Private Sub cmdInput_Click() 'This program allows you to enter your name 'It then displays a hello greeting, followed by your name Dim FullName As String FullName = InputBox("Enter your full name", "Supply Name") Text1.Text = "Hello" & FullName End Sub
the program.
6
Output :
Messages Boxes
A massage box is a special type of Visual Basic window
Example :
ENTER
MsgBox Statement
MsgBox Message string [,ButtonType + Button Icon] [, Caption of title bar]
Example :
2
3 4 5
MsgBox Icons
Icon X
?
!
Value
Description
This critical icon is usually displayed when serious errors or problem occur.
16 32
48 64
The question mark icon is typically displayed when a user must make a decision.
The exclamation mark icon is to draw attention to the message being displayed. This icon indicates that information about an action is being displayed.
12
Activity 2
Create a form named frmMain with :
- A label You Are Now Working With Visual Basic 6.0 name your label as lblIntro. Write the code for Form_Load () event to display message box :
13
Output :
14
Activity 3
Create a Welcome program : Create a form named frmMain as below :
Text1
lblEnter
cmdClick
15
Question :
Write the code to get the output as below :
16
Control Dialog
Control Name Purpose Gets the drive, folder name, and file name for an existing file OpenFileDialog
Gets the drive, folder name and file name for a new file SaveFileDialog
Thank You !!
18