Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is MsgBox functional language

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what is MsgBox functional language". In daily operation, I believe that many people have doubts about what is MsgBox functional language. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what is MsgBox functional language"! Next, please follow the editor to study!

Description

Displays a message in the dialog box, waits for the user to click the button, and returns a value indicating the button the user clicked.

Grammar.

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

The syntax of the MsgBox function has the following parameters:

Parameter description

A string expression that prompt displays as a message in a dialog box. The maximum length of prompt is about 1024 characters, depending on the width of the characters used. If the prompt contains multiple lines, you can separate the lines between them with a carriage return character (Chr (13)), a newline character (Chr (10)), or a combination of carriage return newline characters (Chr (13) & Chr (10)).

A buttons numeric expression that represents the sum of the number and type of display buttons, the icon style used, the identity of the default button, and the message box style. For numerical values, see the Settings section. If omitted, the default value for buttons is 0.

The string expression that title displays in the title bar of the dialog box. If title is omitted, the name of the application is displayed in the title bar.

A helpfile string expression that identifies the help file that provides context-sensitive help to the dialog box. If helpfile is provided, context must be provided. Not available on a 16-bit system platform.

A context numeric expression that identifies the context number assigned to a help topic by the author of the help file. If context is provided, helpfile must be provided. Not available on a 16-bit system platform.

Set up

The buttons parameter can have the following values:

Constant value description

VbOKOnly 0 displays only the OK button.

VbOKCancel 1 displays the OK and cancel buttons.

VbAbortRetryIgnore 2 displays the abandon, retry, and ignore buttons.

VbYesNoCancel 3 displays yes, no, and cancel buttons.

VbYesNo 4 displays yes and no buttons.

VbRetryCancel 5 displays the retry and cancel buttons.

VbCritical 16 displays the critical information icon.

VbQuestion 32 displays the warning query icon.

VbExclamation 48 displays a warning message icon.

VbInformation 64 displays an information message icon.

The first button of vbDefaultButton1 0 is the default button.

The second button of vbDefaultButton2 256 is the default button.

The third button of vbDefaultButton3 512 is the default button.

The fourth button of vbDefaultButton4 768 is the default button.

VbApplicationModal 0 application mode: the user must respond to the message box to continue working in the current application.

VbsystemModal 4096 system mode: all applications are suspended before the user response message box.

The first set of values (0-5) is used to describe the type and number of buttons displayed in the dialog box; the second set of values (16,32,48,64) is used to describe the style of the icon; the third set of values (0256512) is used to determine the default button; and the fourth set of values (0, 4096) determines the style of the message box. When adding these numbers together to generate buttons parameter values, only one number can be fetched from each set of values.

Return value

The MsgBox function has the following return value:

Constant value button

VbOK 1 determines

VbCancel 2 cancel

VbAbort 3 abandon

VbRetry 4 retry

VbIgnore 5 ignore

VbYes 6 is

VbNo 7 No

Description

If 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 ESC has the same effect as clicking cancel. If the dialog box contains help buttons, there is context-sensitive help for the dialog box. However, no value is returned until another button is clicked.

The following example uses the MsgBox function to display an information box and the return value indicates which button was pressed:

Dim MyVar

MyVar = MsgBox ("Hello World!", 65, "MsgBox example") 'MyVar contains either 1 or 2,' depending on the button being pressed.

At this point, the study of "what is the MsgBox functional language" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report