AskBox, AskBox$ (functions)

Syntax AskBox[$](prompt$ [,[default$] [,[title$][,helpfile,context]]])
Description Displays a dialog box requesting input from the user and returns that input as a String .
Comments The AskBox/AskBox$ functions take the following parameters:
Parameter Description
prompt$ String containing the text to be displayed above the text box. The dialog box is sized to the appropriate width depending on the width of prompt$. A runtime error is generated if prompt$ is Null.
default$ String containing the initial content of the text box. The user can return the default by immediately selecting OK. A runtime error is generated if default$ is Null.
title$ String specifying the title of the dialog. If missing, then the default title is used.
helpfile Name of the file containing context-sensitive help for this dialog. If this parameter is specified, then context must also be specified.
context Number specifying the ID of the topic within helpfile for this dialog's help. If this parameter is specified, then helpfile must also be specified.
Function Returns
AskBox$ String containing the input typed by the user in the text box. A zero-length string is returned if the user selects Cancel.
AskBox String variant containing the input typed by the user in the text box. An Empty variant is returned if the user selects Cancel.
When the dialog box is displayed, the text box has the focus. The user can type a maximum of 255 characters into the text box displayed by AskBox$. If both the helpfile and context parameters are specified, then a Help button is added in addition to the OK and Cancel buttons. Context-sensitive help can be invoked by selecting this button or using the help key (F1). Invoking help does not remove the dialog.
s$ = AskBox$ (" Type in the filename:")
s$ = AskBox$ ("Type in the filename:","filename.txt")
Example This example asks the user to enter a filename and then displays what he or she has typed.
Sub Main()
  s$ = AskBox$("Type in the filename:")
  MsgBox "The filename was: " & s$
End Sub
See Also MsgBox (statement); AskPassword$ (function); InputBox, InputBox$ (functions); OpenFilename$ (function); SaveFilename$ (function); SelectBox (function).
Note The text in the dialog box is displayed in 8-point MS Sans Serif.