VBS TUTORIAL: function-inputbox function _vbs

Source: Internet
Author: User

InputBox function

Displays a prompt in the dialog box, waits for the user to enter text or clicks a button, and returns the contents of the text box.

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

Parameters

Prompt

A string expression that is displayed as a message in the dialog box. The maximum length of a prompt is approximately 1024 characters, depending on the width of the character being used. If the prompt contains more than one row, the combination of a carriage return (Chr), anewline character (Chr), or a carriage returnline break can be made between the rows (Chr (& Chr) to separate thelines.

Title

A string expression displayed in the title bar of the dialog box. If you omit title, the name of the application is displayed in the title bar.

Default

A string expression displayed in a text box that is the default response value when there is no other input. If defaultis omitted, the text box is empty.

Xpos

A numeric expression that specifies the horizontal distance (in twips) of the left edge of the dialog box and the left edge of the screen. If xposis omitted, the dialog box is centered horizontally.

Ypos

A numeric expression that specifies the vertical distance (in twips) of the top edge of the dialog box and the top edge of the screen. If yposis omitted, the dialog box displays approximately one-third of the vertical orientation of the screen from the bottom edge.

Helpfile

A string expression identifying the Help file that provides context-sensitive Help for a dialog box. If HelpFileis provided, the context must be provided.

Context

A numeric expression that identifies the context number assigned to a Help topic by the author of the Help file. If the context is already provided, HelpFilemust be provided.

Description

If both the HelpFile and Context are provided, the Help button is automatically added to the dialog box.

If the user clicks OK or presses ENTER, the InputBox function returns the contents of the text box. If the user clicks Cancel , the function returns a 0-length string ("").

The following example uses the InputBox function to display an input box and assign the string to the input variable:

InputBox("Enter name ")  MsgBox (" input:" & Input)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.