InputBox() Function: It displays a prompt in a dialogue box, wait for the user to input text or click button, and returns a string containing the contents of the text box
Syntax:
Inputbox( prompt[, title] [, default] [, xpos] [, ypos], [helpfile, context])
The input box function syntax has this named argument:
Part |
Description |
Prompt |
String expression
displayed as the message in dialogue box |
Title |
Optional. String
expression displayed in the title bar of the dialogue box. If you
omit title, the application name is place in title bar |
Default |
Optional. String
expression displayed in the textbox as the default response. If no
other input is provided |
Xpos |
The horizontal distance
of the left edge of the dialogue box from the left edge of the screen |
Ypos |
Optional.The vertical
distance of the upper edge of the dialogue box from the top of the
screen. |
Helpfile |
Optional. String
expression that identifies the help file to use to provide context sensitive
help for the dialogue box. |
Context |
Optional.
Expression that is the help contact number assigned to the appropriate help
topic by the help author. If context is provided , help file must
also be provided |
Private Sub Command1_Click()
Dim x as integer
x = Inputbox(“ Enter in number”,” Number input”,
“10”,20,30)
Print x
End sub
When a button is clicked, the input box is displayed as follows
Inputbox |
Msgbox() Function:
Displays a message in dialogue box, Wait for user to click a button, and return an integer indicating which button the user click.
Syntax:
Msgbox(prompt, [ buttons], [ title] [, helpfile, context])
The details of the augments passed to the Msgbox function are as follows.
Part |
Description |
Prompt |
Required. String
expression displayed as the message in the dialogue box |
Buttons |
Optional. Numeric
expression that is the sum of values specifying the number and types buttons
to display, the Icon style to use, the identify of the default
button, and the modality of the message box. If omitted the default
value of the button 0. |
Title |
Optional. String
expression displayed in the title bar of the dialogue box. If you omit
title the application name is place in the title bar. |
Helpfile |
Optional. String
expression that identifies a help file to use to provide context sensitive
help for the dialogue box. If help file is provided context must also
be provided |
Context |
Optional. numeric expression that is to help contact number assigned to the appropriate help topic by the help author. if context is provided, helpfile must also be provided |
The Msgbox() function return a value depending upon the button clicked,
Constant |
Value |
Description |
VbOK |
1 |
Ok |
VbCancel |
2 |
Cancel |
VbAbort |
3 |
Abort |
VbRetry |
4 |
Retry |
VbIgnore |
5 |
Ignore |
VbYes |
6 |
Yes |
VbNo |
7 |
No |
The message box is always displayed at the centre
of the screen.
Private Sub Command1_Click()
Dim x as integer
x = Msgbox(“ Are you sure”, vbYesNoCancel+vbQuestion,
” confirmation”)
End sub
Msgbox |
No comments:
Post a Comment