InputBox Procedure

Displays a modal dialog box used to input a string from the user. The dialog box contains a message, a text box control and two buttons OK and Cancel.

Syntax

[ lBoxId = ] InputBox ( sMessage  [, sTitle]  [, psReturn])

The InputString procedure syntax has the following parts:

 

Name

Type

Description

lBoxId

enumAMsgBoxIds

Return value indicating what button was pressed (OK or Cancel).

sMessage

Val BString

String expression displayed above the text box used to describe the input that the user is required to input.

sTitle

Val BString

String expression displayed in the title bar of the dialog box. If you omit sTitle, the application name is placed in the title bar.

psReturn

Var BString

String variable that contains the initial text to be displayed in the text box. On return, the variable contains the string as input by the user If OK was pressed, otherwise, the string remains as is.

Where

enumAMsgBoxId can be one of the following:

 

Name

Value

Description

aIdOk

1

OK

aIdCancel

2

Cancel

Comments

If the dialog box displays a Cancel button, pressing the ESC key has the same effect as clicking Cancel.

If sMessage consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or carriage return – linefeed character combination (Chr(13) & Chr(10)) between each line.

When the input box is displayed its parent window is disabled until the user clicks on one of the buttons and closes the input box window. The parent window is determined by ATEasy by using the Form internal variable as a parent. If the function is not called from within a form, ATEasy will use the current active top-level window as a parent that belongs to the same thread.

Example

The following example displays a input string dialog :

s="000000"

if InputBox("Enter the UUT serial Number.\r\nEnter only numbers.", , s)=aMsgOk

g_sSerial=s

endif

See Also

MsgBeep, MsgBox