InputBox Function |
Microsoft.VisualBasic.Interaction
InputBox( prompt [, title ] [, defaultresponse ] [, xpos ] _ [, ypos ])
The message in the dialog box
The title bar of the dialog box
String to be displayed in the text box on loading
The distance in twips from the left-hand side of the screen to the left-hand side of the dialog box
The distance in twips from the top of the screen to the top of the dialog box
A String containing the contents of the text box from the InputBox dialog box
Displays a dialog box containing a prompt for the user , a text box for entering data, and an OK, a Cancel, and ( optionally ) a Help button. When the user clicks OK, the function returns the contents of the text box.
If the user clicks Cancel, a zero-length string ("") is returned. Thus, once again, Microsoft has apparently made it impossible for us to distinguish when the user enters the empty string and when the user hits the Cancel button.
prompt can contain approximately 1,000 characters, including nonprinting characters like the intrinsic vbCrLf constant.
If the title argument is omitted, the name of the current application or project is displayed in the title bar.
If you don't use the default parameter to specify a default entry for the text box, the text box is shown as empty, and a zero-length string is returned when the user does not enter anything in the text box prior to clicking OK.
xpos and ypos are specified in twips.
If the xpos parameter is omitted, the dialog box is centered horizontally.
If the ypos parameter is omitted, the top of the dialog box is positioned approximately one-third of the way down the screen.
If you are omitting one or more of the optional arguments and are using subsequent arguments, you must use a comma to signify the missing parameter. For example, the following code fragment will display a prompt, a default string in the text box, and the Help button, but default values will be used for the title and positioning.
Dim sString As String = InputBox("Enter it now", , _ "Something")
Note that InputBox returns a string. Your code is responsible for converting it to the required data type before using it.
MsgBox Function