http://www.lob.cn/jq/kfjq/570.shtml
VB.Net中MsgBox函数的使用方法 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
作者:佚名 来源:乐博网收集 更新时间:2007-11-24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MsgBox: Prompts a dialog Box that displays a message. Examples:
information from the MSDN:MsgBox Function Parameters
SettingsTheMsgBoxStyleenumeration values are listed in the following table.
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) determines which button is the default; the fourth group (0,4096) determines the modality of the message Box,and the fifth group specifies whether or not the message Box window is the foreground window,along with the alignment and direction of the text. When adding numbers to create a final value for theButtonsargument,use only one number from each group. Return Values
Exceptions/Errors
RemarksIf the dialog Box displays aCancelbutton,pressing the ESC key has the same effect as clickingCancel. If the dialog Box contains aHelpbutton,context-sensitive Help is provided for the dialog Box. However,no value is returned until one of the other buttons is clicked. NoteTo specify more than the first argument,you must use the MsgBoxfunction in an expression. If you omit any positional arguments,you must retain the corresponding comma delimiter. ExampleThis example uses theMsgBoxfunction to display a critical-error message in a dialog Box with Yes and No buttons. The No button is specified as the default response. This is done by combining theMsgBoxconstant values into one numeric expression. In this case,adding 4 (the Yes/No button combination) and 16 (the Critical Message window) and 256 (the second button as default button) gives a total of 276. The value returned by theMsgBoxfunction depends on the button chosen by the user: Yes returns a value of 6; No returns a value of 7. Dim msg As String Dim title As String Dim style As MsgBoxStyle Dim response As MsgBoxResult msg = "Do you want to continue?" ' Define message. style = MsgBoxStyle.DefaultButton2 Or _ MsgBoxStyle.Critical Or MsgBoxStyle.YesNo title = "MsgBox Demonstration" ' Define title. ' display message. response = msg,style,title ' or MsgBox(msg,MsgBoxStyle.YesNo,title) If response = MsgBoxResult.Yes Then ' User chose Yes. ' Perform some action. Else ' Perform some other action. End IfMsgBox() |
原文地址:https://www.jb51.cc/vb/256031.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。