Previous Topic: ClearScreen or ClrScr - Clear the ScreenNext Topic: MessageBox or MsgBox - Display a Message Box Window


InputBox - Create, Display, and Operate a Message Box Window

Valid on Windows and Windows CE

The InputBox function creates, displays, and operates a message box window. The message box contains an application-defined prompt, title, and a text box with an application-defined default value, and the OK and Cancel buttons.

This miscellaneous function has the format:

InputBox(
	prompt as String,
	title as String,
	default as String) as Boolean
prompt

Indicates the prompt to be displayed.

title

Specifies the message box title.

default

Specifies the default prompt input. If default is not a variable, a syntax error exists.

Note: The input box is NOT placed in the foreground.

If the OK button was selected, the function returns TRUE and copies the contents of the text box into the default variable. If the Cancel button was selected, the function returns FALSE and leaves the default variable unchanged.

Example:

This example demonstrates the use of InputBox.

Dim TargetPath, Question as string

TargetPath=WindowsDir

Question="Please specify the directory to use for installation"
if InputBox(Question,"Install",TargetPath) then

	 ' Place code for actual installation here...

	 MessageBox("Installation completed")
else
	 MessageBox("Installation aborted")
End if

End: