InputBox$
<< Click to Display Table of Contents >> InputBox$ |
Description
Displays a dialog box containing a prompt. Waits for the user to enter text, and accept or cancel the dialog.
Returns the contents of the text box.
Syntax
s = InputBox$([hParent,] Prompt [, Title [, DefaultText [, Pass]] ] )
Returns
String
Parameters
Name |
Type |
Optional |
Meaning |
hParent |
Numeric |
Yes |
Handle of parent window |
Prompt |
String |
No |
String to be used as user prompt |
Title |
String |
Yes |
Title of the input box dialog |
DefaultText |
String |
Yes |
Default text to be defaulted into input textbox |
Pass |
Numeric |
Yes |
%TRUE or %FALSE. If %TRUE, display an asterisk (*) for each character typed into the control in order to obscure the password |
Remarks
Restrictions
See also
Examples
Thanks to Mark_D for the following script example
Dim s As String Value = ""
Dim Prompt As String Value = "Enter Some thing here"
Dim Title As String Value = "InputBox Example" '---Optional, can be left out
Dim DefaultText As String Value = "press keyboard keys to change me" '---Optional, can be left out
Dim sMsg As String Value = ""
'---Assign the variable 's' to what is entered in the INPUTBOX
s = InputBox$(Prompt ,Title, DefaultText)
'---Prepare the 'sMsg' variable
sMsg = " You entered: " & $CRLF
sMsg += s & $CRLF
'---Display a MessageBox to show what the user entered in the INPUTBOX
MsgBox 0, sMsg