MSGBOX返回值

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

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

Arguments
prompt

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.

buttons

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.

title

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

helpfile

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.

context

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
The buttons argument settings are:

Constant Value Description
vbOKOnly 0 Display OK button only.
vbOKCancel 1 Display OK and Cancel buttons.
vbAbortRetryIgnore 2 Display Abort, Retry, and Ignore buttons.
vbYesNoCancel 3 Display Yes, No, and Cancel buttons.
vbYesNo 4 Display Yes and No buttons.
vbRetryCancel 5 Display Retry and Cancel buttons.
vbCritical 16 Display Critical Message icon.
vbQuestion 32 Display Warning Query icon.
vbExclamation 48 Display Warning Message icon.
vbInformation 64 Display Information Message icon.
vbDefaultButton1 0 First button is default.
vbDefaultButton2 256 Second button is default.
vbDefaultButton3 512 Third button is default.
vbDefaultButton4 768 Fourth button is default.
vbApplicationModal 0 Application modal; the user must respond to the message box before continuing work in the current application.
vbSystemModal 4096 System modal; all applications are suspended until the user responds to the message box.

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.

Return Values
The MsgBox function has the following return values:

Constant Value Button
vbOK 1 OK
vbCancel 2 Cancel
vbAbort 3 Abort
vbRetry 4 Retry
vbIgnore 5 Ignore
vbYes 6 Yes
vbNo 7 No

Remarks
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.

The following example uses the MsgBox function to display a message box and return a value describing which button was clicked:

Dim MyVar
MyVar = MsgBox ("Hello World!", 65, "MsgBox Example")
' MyVar contains either 1 or 2, depending on which button is clicked.
Requirements

时间: 2024-11-02 01:26:59

MSGBOX返回值的相关文章

C#中调用消息对话框,并取得其返回值

对话框 不同于VB中可以直接使用MsgBox来得到消息框的返回值,在C#中需要使用 DialogResult 类型的变量,从MessageBox.show()方法接受消息对话框的返回值.至于MessageBox.show()的返回值是 Yes .No, Ok还是Cancel,那需要自己在Show()方法中对它可以显示的选择按钮进行设置.以下示例代码可以参考: // Initializes the variables to pass to the MessageBox.Show method. s

cript-VBS脚本如何把数据库里面返回值赋给脚本里面的一个变量啊!

问题描述 VBS脚本如何把数据库里面返回值赋给脚本里面的一个变量啊! VBS脚本如何把数据库里面返回值赋给脚本里面的一个变量啊! 只返回某字段查找的某一个值,我试了好久就是不成功. 上网查的方法,不会用: setrs=connObj.execute(strSQLCode)ifnotrs.eofthenmsgboxrs(字段名)或用setrs=server.createobject(adodb.recordset)rs.openSQL,connObj,1,1ifnotrs.eofthenmsgbo

access-程序编译错误,recordcount返回值为-1

问题描述 程序编译错误,recordcount返回值为-1 Option Explicit Private Sub text1_validate(cancel As Boolean) If IsNumeric(Text1.Text) = False Then MsgBox "请输入日期" End If End Sub Private Sub Command1_Click() Dim cn As New ADODB.Connection Dim cm As New ADODB.Comma

mysql-VB 读取 MySql 存储过程返回值

问题描述 VB 读取 MySql 存储过程返回值 -- 我定义的存储过程如下,很简单的一个过程,并且在Cmd命令里面运行是正常的.USE appraisesystem;DROP procedure IF EXISTS protest; DELIMITER $$USE appraisesystem$$CREATE DEFINER=root@% PROCEDURE protest(Word varchar(100)out lens int)BEGINset lens=length(Word);END

数据库无返回值错误

问题描述 DimAccessConnAsNewOleDb.OleDbConnection(AccessConnectionString)'建立链接AccessConn.Open()'打开数据库Fora=1ToListView1.Items.CountDimAccessStringAsString="INSERTINTO入库单(日期,班级,规格,半品,成品,总件数,隔纸,种类,克重,产量,吨位)VALUES('"&_ListView1.Items.Item(a-1).Text&a

vb中2005中如何获取messbox的返回值(要详细介绍)顺便推荐学vb2005的教程,谢谢各位了!

问题描述 vb中2005中如何获取messbox的返回值(要详细介绍)顺便推荐学vb2005的教程,谢谢各位了! 解决方案 解决方案二:Result=MessageBox()Result=Msgbox()解决方案三:笨蛋方法:dimaasinteger=msgbox("笨蛋方法",1,"大笨蛋")ifa=1then...ifa=2then...

VBS中InputBox函数的返回值使用技巧_vbs

如果用户单击确定或按下 ENTER,则 InputBox 函数返回文本框中的内容.如果用户单击取消,则函数返回一个零长度字符串 (""). 这是参考手册对InputBox函数返回值的说明,简单而明了,还有必要专门写一篇文章来讨论?我知道你一定对标题不屑一顾,换成是我,我也一定会不屑一顾,如果我没有看到百度VBS吧里的一个帖子. 关于Inputbox 疑惑 ---------------------------- 如果用户单击确定或按下 ENTER,则 InputBox 函数返回文本框中

一个类如何实现两个接口中同名同参数不同返回值的函数

假设有如下两个接口: public interface IA{    string GetA(string a);}public interface IB{    int GetA(string a);} 他们都要求实现方法GetA,而且传入的参数都是一样的String类型,只是返回值一个是String一个是Int,现在我们要声明一个类X,这个类要同时实现这两个接口: public class X:IA,IB 由于接口中要求的方法的方法名和参数是一样的,所以不可能通过重载的方式来解决,那么我们该

nodejs如何将数据返回给前端的post请求,在浏览器preview能看到返回值

问题描述 nodejs如何将数据返回给前端的post请求,在浏览器preview能看到返回值 前端使用ajax请求post方法请求nodejs服务.nodejs如何将数据返回给前端,并且在浏览器的preview中能得到,新手,在线急等