Home > Common Problem > body text

What is the return value type of msgbox function?

青灯夜游
Release: 2020-12-18 15:17:39
Original
9097 people have browsed it

The return value type of the MsgBox function is "numeric type". The function of the MsgBo function is to pop up a dialog box, wait for the user to click a button, and return an Integer value indicating which button the user clicked.

What is the return value type of msgbox function?

Related recommendations: "Programming Video"

The return value type of the MsgBox function is "numeric value" type".

MsgBox is a function in Visual Basic and VBS.

MsgBox displays messages in a simple dialog box. This dialog box can include predefined buttons and items, and the user wants to specify the message, title, buttons, and items used in the dialog box. MsgBox can be used to display a message in a dialog box and wait for the user to click a button, and then return an integer value to let the program know which button the user clicked.

"MsgBox" is the abbreviation of "Message Box", which means "mailbox" in English.

Syntax

MsgBox (Prompt [,Buttons] [,Title] [,Helpfile,Context])
Copy after login

Parameters:

MsgBox function parameters
Part
Description
Prompt
Required. String expression that displays the message in the dialog box. The maximum length of a prompt is approximately
1024 characters, determined by the byte size of the characters used. If the content of Prompt exceeds one line, you can use carriage return (Chr(13)), line feed (Chr(10)) or a combination of carriage return and line feed (Chr(13) & Chr( 10), i.e. vbCrLf) to separate the lines.
Buttons
Optional. Numerical expression is the sum of some numerical values, specifying the number and form of buttons displayed, the icon style (and sound) used, the default button and the mandatory status of the message box, etc. If omitted, its default value is 0. See the "Parameter Setting Values" table for specific values.
Title
Optional. String expression, the content displayed in the title bar of the dialog box. If Title is omitted, the application title (App.Title) is placed in the title bar.
Helpfile
Optional. String expression used to provide context-sensitive help to a help file for a dialog box. If Helpfile is provided, Context must also be provided.
Context
Optional. Numeric expression that is the help context number assigned to the appropriate help topic by the author of the help file. If Context is provided, Helpfile must also be provided.

Parameter setting value:

##Display " OK" and "Cancel" buttons. vbAbortRetryIgnore2vbYesNoCancelvbYesNovbRetryCancelThe style of the icon (may be accompanied by a sound depending on the system settings)vbCriticalvbQuestionvbExclamationvbInformationDefault Button##vbDefaultButton1##512The third button is the default button. 768

These constants are specified by Visual Basic for Applications (VBA). Therefore, you can use these constant names in program code without using the actual values.

Return value:

Buttons parameter setting value
Constant
Value
Description
The type and number of buttons displayed in the dialog box
vbOKOnly
0
Only displays the "OK" button. (Default)
##vbOKCancel
1
##Displays "termination", " Retry" and "Ignore" buttons.
3
Display "Yes", " No" and "Cancel" buttons.
4
Displays "Yes" and " No" button.
5
Display "Retry" and "Cancel" button.
16
Display the "Error Message" icon.
32
Display the "Ask for Information" icon .
48
Display "Warning Message" icon .
64
Display "Notification Message" icon .
0
#The first button is the default button. (Default)
##vbDefaultButton2
256
Second button is the default button.
vbDefaultButton3
vbDefaultButton4
The fourth button is the default button.
Forced return of dialog box
vbApplicationModal
0
The application is forced to return; the application is suspended until the user responds to the message box.
vbSystemModal
4096
The system forces return; apply all The program is suspended until the user responds to the message box.
Dialog special settings
vbMsgBoxHelpButton
16384
Add a help button to the message box.
vbMsgBoxSetForeground
65536
Specifies the message box window as the foreground window.
vbMsgBoxRight
##524288
The text is right aligned.
vbMsgBoxRtlReading
1048576
Specifies that the text should be in Greek Right-to-left display in Hebrew and Arabic systems.
MsgBox function return value
Constant
Value
Description
##vbOK
1
Clicked the "OK" button.
vbCancel
2
Clicked Cancel button.
vbAbort
3
Clicked "Abort" button.
vbRetry
4
Clicked "Retry" " button.
vbIgnore
5
Clicked "Ignore" button.
vbYes
6
Clicked "Yes" button.
vbNo
7
Clicked No button.
To read more related articles, please visit

PHP Chinese website! !

The above is the detailed content of What is the return value type of msgbox function?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template