HOME

VBScript Tutorial
VB HOME
VB Introduction
VB How to
VB Where to
VB Variables
VB Procedures
VB Conditional
VB Looping

Examples
VB Examples

References
VB Functions
VB Keywords

Please visit our sponsors !

The InputBox Function

Back

The InputBox function displays a dialog box, where the user can write some input and/or click on a button. If the user clicks the OK button or presses ENTER on the keyboard, the InputBox function will return the text in the text box. If the user clicks on the Cancel button, the function will return an empty string ("").

Note: A Help button is added to the dialog box when both the helpfile and the context parameter are specified.

Tip: Also look at the MsgBox function.

Syntax

InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context])

Parameter Description
prompt Required. The message to show in the dialog box. Maximum length is 1024 characters. 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
title Optional. The title of the dialog box. Default is the application name
default Optional. A default text in the text box
xpos Optional. The horizontal distance of the left edge of the dialog box from the left edge of the screen. If omitted, the dialog box is horizontally centered
ypos Optional. The vertical distance of the upper edge of the dialog box from the top of the screen. If omitted, the dialog box is vertically positioned one-third of the way down the screen
helpfile Optional. The name of a Help file to use. Must be used with the context parameter
context Optional. The Help context number to the Help topic. Must be used with the helpfile parameter

Example 1

dim fname
fname=InputBox("Enter your name:")
MsgBox("Your name is " & fname)


Back

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page


Search W3Schools:


What Others Say About Us

Does the world know about us? Check out these places:

Dogpile Alta Vista MSN Google Excite Lycos Yahoo Ask Jeeves


We Help You For Free. You Can Help Us!


W3Schools is for training only. We do not warrant its correctness or its fitness for use. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2002 by Refsnes Data. All Rights Reserved


Validate How we converted to XHTML Validate

IISCart
ASP Ecommerce & Shopping Cart


Your own Web Site?

Read W3Schools
Hosting Tutorial



$15 Domain Name
Registration
Save $20 / year!



Advertise
at W3Schools

Only 0.5 CPM



SELECTED LINKS

University Online
Master Degree
Bachelor Degree


Web Software

The Future of
Web Development


Jobs and Careers

Web Security
Web Statistics
Web Standards


PARTNERS

W3Schools
TopXML
VisualBuilder
XMLPitstop
DevelopersDex
DevGuru
Programmers Heaven
The Code Project
Tek Tips Forum
ZVON.ORG
TopXML Search