Home > Language Reference > User Dialog Functions > InputBox$

InputBox$

The InputBox$ function displays a prompt in a dialog box, waits for the user to input text or click a button, and then returns a string containing the contents of the text box.

Usage

Used to ask user a question and the answer can then be used in the next steps. If the answer must be crypted, use InputBoxSecret$ function.

Syntax

var$=InputBox$(<prompt> [, [<title>][, [<default_answer>][, [<x>], [<y>]]]])>]

Parameters

<prompt>, string, message in the dialog box. 

<title>, optional, string, text displayed in the title bar of the dialog box. 

<default_answer>, optional, string, default response if no input is provided.

<x>,<y>, optional, integers, coordinates of the topleft point of the dialog box.

Return value

var$, string, input text typed by user in the dialog box. If the Cancel button is clicked, var$ returns "ID_CANCEL".

See also

InputBoxSecret$

Examples

var$ = InputBox$("Type your answer below:","Inputbox Title", "Today")
msgbox(var$) 
    
prompt$="Type your answer below:"
title$="InputBox Title"  
default$="Default answer"
x=100
y=120
var$ = InputBox$( prompt$, title$, default$, x, y)
msgbox(var$)
    
var$ = InputBox$( prompt$)

var$ = InputBox$( prompt$, , , 100, 100)