InputBox Statement

Displays a prompt in a dialog box, waits for the operator to input text or choose a button, and returns the contents of the box.

Syntax
InputBox prompt, title, default, data$

Parameters

prompt
String expression displayed as a message in the dialog box.
title
String expression displayed in the title bar of the dialog box.
default
String expression displayed in the text box as the default response. If no default is desired, use an empty string (“”). (" ")
data$
A string variable which will contain what the operator entered. If the operator clicks Cancel, this string will be “@”.

Description
InputBox displays the dialog and waits for the operator to click OK or Cancel. data is a string that contains what the operator typed in.

See Also
MsgBox

InputBox Statement Example
This function shows an InputBox example.

Function GetPartName$ As String
    String prompt$, title$, data$

    prompt$ = "Enter " + Chr$(34) + "part name" + Chr$(34) + ":"
    title$ = "Sample Application"
    InputBox prompt$, title$, "", data$
    If data$ <> "@" Then
        GetPartName$ = data$
    EndIf
Fend

The following picture shows the example output from the InputBox example code shown above.

Restriction
If the prompt, title, and default of parameter contain a half-width comma ",", the string cannot be displayed correctly. Use a string that does not contain a half-width comma.