banner



How To Change Color Of Vbs Pop Up Message Box

VBScript - Dialog Boxes



What is a Dialog Box ?

VBScript allows the developers to interact with the user effectively. Information technology tin can be a message box to display a message to a user or an input box with which user can enter the values.

VBScript MsgBox Function

The MsgBox function displays a message box and waits for the user to click a push and then an activity is performed based on the button clicked by the user.

Syntax

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

Parameter Clarification

  • Prompt − A Required Parameter. A Cord that is displayed as a message in the dialog box. The maximum length of prompt is approximately 1024 characters. If the message extends to more than a line, then nosotros can carve up the lines using a railroad vehicle return grapheme (Chr(xiii)) or a linefeed character (Chr(10)) between each line.

  • buttons − An Optional Parameter. A Numeric expression that specifies the type of buttons to brandish, the icon style to use, the identity of the default button, and the modality of the message box. If left bare, the default value for buttons is 0.

  • Title − An Optional Parameter. A String expression displayed in the title bar of the dialog box. If the title is left blank, the awarding name is placed in the title bar.

  • helpfile − An Optional Parameter. A String expression that identifies the Help file to utilize to provide context-sensitive help for the dialog box.

  • context − An Optional Parameter. A Numeric expression that identifies the Help context number assigned by the Help author to the appropriate Help topic. If context is provided, helpfile must likewise be provided.

The Buttons parameter tin take whatever of the post-obit values −

  • 0 vbOKOnly Displays OK push button only.

  • 1 vbOKCancel Displays OK and Cancel buttons.

  • ii vbAbortRetryIgnore Displays Abort, Retry, and Ignore buttons.

  • three vbYesNoCancel Displays Yeah, No, and Cancel buttons.

  • four vbYesNo Displays Yes and No buttons.

  • 5 vbRetryCancel Displays Retry and Abolish buttons.

  • 16 vbCritical Displays Critical Message icon.

  • 32 vbQuestion Displays Alert Query icon.

  • 48 vbExclamation Displays Warning Bulletin icon.

  • 64 vbInformation Displays Information Message icon.

  • 0 vbDefaultButton1 First push is default.

  • 256 vbDefaultButton2 2nd push button is default.

  • 512 vbDefaultButton3 Third push is default.

  • 768 vbDefaultButton4 Fourth button is default.

  • 0 vbApplicationModal Awarding modal. The current application volition not piece of work until the user responds to the message box.

  • 4096 vbSystemModal Arrangement modal. All applications will not work until the user responds to the message box.

The above values are logically divided into four groups: The commencement group(0 to 5) indicates the buttons to be displayed in the message box. The 2nd group (sixteen, 32, 48, 64) describes the sytle of the icon to be displayed, the third group (0, 256, 512, 768) indicates which button must be the default, and the quaternary group (0, 4096) determines the modality of the bulletin box.

Return Values

The MsgBox function tin return one of the post-obit values −

  • 1 - vbOK - OK was clicked

  • ii - vbCancel - Abolish was clicked

  • 3 - vbAbort - Abort was clicked

  • 4 - vbRetry - Retry was clicked

  • 5 - vbIgnore - Ignore was clicked

  • half dozen - vbYes - Yes was clicked

  • 7 - vbNo - No was clicked

Case

<!DOCTYPE html> <html>    <body>       <script language = "vbscript" blazon = "text/vbscript">          'Message Box with merely prompt message          MsgBox("Welcome")                          'Message Box with title, yep no and cancel Butttons           a = MsgBox("Exercise yous similar blue colour?",3,"Choose options")          ' Assume that you lot printing No Button	          document.write("The Value of a is " & a)                 </script>    </body> </html>        

When the above script is executed, the message box is displayed, and if yous press No Push, and so the value of a is 7.

The Value of a is vii        

VBScript InputBox Function

The InputBox function helps the user to get the values from the user. After entering the values, if the user clicks the OK push button or presses ENTER on the keyboard, the InputBox function volition return the text in the text box. If the user clicks on the Cancel push, the office will return an empty string ("").

Syntax

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

Parameter Description

  • Prompt − A Required Parameter. A Cord that is displayed equally a message in the dialog box. The maximum length of prompt is approximately 1024 characters. If the bulletin extends to more than a line, then we tin can separate the lines using a carriage return character (Chr(13)) or a linefeed character (Chr(x)) between each line.

  • Title − An Optional Parameter. A String expression displayed in the title bar of the dialog box. If the title is left blank, the application proper noun is placed in the title bar.

  • Default − An Optional Parameter. A default text in the text box that the user would similar to be displayed.

  • XPos − An Optional Parameter. The Position of Ten axis which represents the prompt distance from left side of the screen horizontally. If left bare, the input box is horizontally centered.

  • YPos − An Optional Parameter. The Position of Y axis which represents the prompt distance from left side of the screen Vertically. If left blank, the input box is Vertically centered.

  • helpfile − An Optional Parameter. A Cord expression that identifies the Assist file to use to provide context-sensitive Help for the dialog box.

  • context − An Optional Parameter. A Numeric expression that identifies the Aid context number assigned by the Help author to the appropriate Assistance topic. If context is provided, helpfile must besides be provided.

Instance

<!DOCTYPE html> <html>    <torso>       <script linguistic communication = "vbscript" type = "text/vbscript">          ' Input Box with simply Prompt          InputBox("Enter a number")                       ' Input Box with a Title          a = InputBox("Enter a Number","Enter Value")          msgbox a                   ' Input Box with a Prompt,Championship and Default value          a = InputBox("Enter a Number","Enter Value",123)          msgbox a                   ' Input Box with a Prompt,Title,Default and XPos          a = InputBox("Enter your name","Enter Value",123,700)          msgbox a                   ' Input Box with a Prompt,Title and Default and YPos          a = InputBox("Enter your proper name","Enter Value",123,,500)          msgbox a                 </script>    </body> </html>        

When the above script is executed, the input box is displayed and displays the entered value by the user.

Useful Video Courses


VB.NET Masterclass: Learn Visual Basic and VBScript

Video

Source: https://www.tutorialspoint.com/vbscript/vbscript_dialog_boxes.htm

Posted by: garberherrinfold.blogspot.com

0 Response to "How To Change Color Of Vbs Pop Up Message Box"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel