Sideway
output.to from Sideway





InputBox, MsgBox


Draft for Information Only

VBScript Misc Functions

Functions for manipulating misc operation. However all modern browser does not support VBScript InputBox and MsgBox functions directly.

InputBox Function

last updated 2017/9/19

Create and display a standard input dialog box with a text box and a given prompt in the dialog box according to the specified title, default, xpos, ypos, helpfile and context arguments. The dialog box will wait for the user to input text or click a button to continue.

Syntax

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

Argument

promptRequired. String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt 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.titleOptional. String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.defaultOptional. String expression displayed in the text box as the default response if no other input is provided. If you omit default, the text box is displayed empty.xposOptional. Numeric expression that specifies, in twips, the horizontal distance of the left edge of the dialog box from the left edge of the screen. If xpos is omitted, the dialog box is horizontally centered.yposOptional. Numeric expression that specifies, in twips, the vertical distance of the upper edge of the dialog box from the top of the screen. If ypos is omitted, the dialog box is vertically positioned approximately one-third of the way down the screen.helpfileOptional. String expression that identifies the Help file to use to provide context-sensitive Help for the dialog box. If helpfile is provided, context must also be provided.contextOptional. Numeric expression that identifies the Help context number assigned by the Help author to the appropriate Help topic. If context is provided, helpfile must also be provided.

Returns

Returns a Variant of the String data subtype containing the contents of the text box obtained from input dialog box entered by the user.

Remarks

  • All modern browser does not support VBScript InputBox and MsgBox functions.
  • InputBox function is used to accept and return input text from user.
  • When both helpfile and context are supplied, a Help button is automatically added to the dialog box.
  • If the user clicks OK or presses ENTER, the InputBox function returns whatever is in the text box. If the user clicks Cancel, the function returns a zero-length string ("").

Requirement

1

Examples

Although all modern browser does not support VBScript InputBox and MsgBox functions directly, VBScript can still be tested using Microsoft Internet Explorer 11 after adding '<meta http-equiv="x-ua-compatible" content="IE=10">' to HEAD tag.

Both client side VBScript InputBox and MsgBox functions can be used in server side indirectly through creating a client side Script on the fly to run a ?document.write?.

Ref.:https://msdn.microsoft.com/library/dn384057(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/apps/Hh700404.aspx

Examples of InputBox function

Ref.:

ASP VbScript Command:
<!DOCTYPE html><html>
<head><meta http-equiv="x-ua-compatible" content="IE=10"></head>
<body><%
Response.Write("<" & "script language=VBScript  type=text/vbscript>")
Response.Write("a=InputBox(""test msg"")"&vbCrLf)
Response.Write ("document.write a")
Response.Write ("<" & "/script>")
%></body>
</html>

MsgBox Function

last updated 2017/9/20

Create and display a standard message dialog box with a given prompt in the dialog box according to the specified buttons, title, helpfile and context arguments. The dialog box will wait for the user to click a button to continue.

Syntax

MsgBox(prompt[, buttons][, title][, helpfile, context])

Argument

promptRequire. String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt 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.buttonsOptional Setting. Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. See Settings section for values. If omitted, the default value for buttons is 0.titleRequired. String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.helpfileRequired. String expression that identifies the Help file to use to provide context-sensitive Help for the dialog box. If helpfile is provided, context must also be provided. Not available on 16-bit platforms.contextRequired. Numeric expression that identifies the Help context number assigned by the Help author to the appropriate Help topic. If context is provided, helpfile must also be provided. Not available on 16-bit platforms.

Settings

buttons argument

vbConstantValueConstantvbOKOnly0Display OK button only.vbOKCancel1Display OK and Cancel buttons.vbAbortRetryIgnore2Display Abort, Retry, and Ignore buttons.vbYesNoCancel3Display Yes, No, and Cancel buttons.vbYesNo4Display Yes and No buttons.vbRetryCancel5Display Retry and Cancel buttons.vbCritical16Display Critical Message icon. vbQuestion32Display Warning Query icon.vbExclamation48Display Warning Message icon.vbInformation64Display Information Message icon.vbDefaultButton10First button is default.vbDefaultButton2256Second button is default.vbDefaultButton3512Third button is default.vbDefaultButton4768Fourth button is default.vbApplicationModal0Application modal. The user must respond to the message box before continuing work in the current application.vbSystemModal4096System modal. On Microsoft Win16 systems, all applications are suspended until the user responds to the message box. On Microsoft Win32 systems, this constant provides an application modal message box that always remains on top of any other programs that you have running
The first group of values (0–5) describes the number and type of buttons displayed in the dialog box; the second group (16, 32, 48, 64) describes the icon style; the third group (0, 256, 512, 768) determines which button is the default; and the fourth group (0, 4096) determines the modality of the message box. When adding numbers to create a final value for the argument buttons, use only one number from each group.

Returns

Returns a Variant of the Integer data subtype containing the type of button obtained from message dialog box clicked by the user.

Return values of MsgBox function

vbConstantValueConstantvbOK1OKvbCancel2CancelvbAbort3AbortvbRetry4RetryvbIgnore5IgnorevbYes6YesvbNo7No

Remarks

  • All modern browser does not support VBScript InputBox and MsgBox functions.
  • InputBox function is used to accept and return input text from user.
  • When both helpfile and context are provided, the user can press F1 to view the Help topic corresponding to the context.
  • If the dialog box displays a Cancel button, pressing the ESC key has the same effect as clicking Cancel. If the dialog box contains a Help button, context-sensitive Help is provided for the dialog box. However, no value is returned until one of the other buttons is clicked.
  • When the MsgBox function is used with Microsoft Internet Explorer, the title of any dialog presented always contains "VBScript:" to differentiate it from standard system dialogs.

Requirement

1

Examples

Although all modern browser does not support VBScript InputBox and MsgBox functions directly, VBScript can still be tested using Microsoft Internet Explorer 11 after adding '<meta http-equiv="x-ua-compatible" content="IE=10">' to HEAD tag.

Both client side VBScript InputBox and MsgBox functions can be used in server side indirectly through creating a client side Script on the fly to run a ?document.write?.

Ref.:https://msdn.microsoft.com/library/dn384057(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/apps/Hh700404.aspx

Examples of MsgBox function

ASP VbScript Command:
<!DOCTYPE html><html>
<head><meta http-equiv="x-ua-compatible" content="IE=10" /></head>
<body><%
Response.Write("<" & "script language=VBScript  type=text/vbscript>")
Response.Write("a=MsgBox(""test msg"")"&vbCrLf)
Response.Write ("document.write a")
Response.Write ("<" & "/script>")
%></body>
</html>

©sideway

ID: 180400010 Last Updated: 2018/4/10 Revision:

IMAGE

Home (1)

Business

Management

HBR (3)

Information

Recreation

Hobbies (7)

Culture

Chinese (1097)

English (330)

Reference (60)

Computer

Hardware (147)new

Software

Application (184)

Digitization (22)

Numeric (19)

Programming

Web (507)

HTML

Knowledge Base

Common Color (1)

Html Entity (Unicode) (1)

Html 401 Special (1)

OS (305)new

MS Windows

Windows10 (1)

DeskTop (5)

Knowledge

Mathematics

Formulas (7)

Number Theory (51)

Algebra (14)

Trigonometry (18)

Geometry (18)

Calculus (66)

Engineering

Tables (8)

Mechanical

Control

Process Control (1)

Mechanics (1)

Rigid Bodies

Statics & Dynamics (128)

Fluid (5)

Fluid Kinematics (5)

Acoustics (19)

FiniteElement (2)

Biology (1)

Geography (1)


facebook
Latest Updated Links

Copyright © 2000-2018 Sideway . All rights reserved Disclaimersfacebook last modified on 08 Mar 2018