一、可用按钮(指定消息框显示哪些按钮)
MsgBoxStyle.OkOnly = vbOKOnly = 0(确定按钮)
MsgBoxStyle.OkCancel = vbOKCancel = 1(确定、取消按钮)
MsgBoxStyle.AbortRetryIgnore = vbAbortRetryIgnore = 2(终止、重试、忽略按钮)
MsgBoxStyle.YesNoCancel = vbYesNoCancel = 3(是、否、取消按钮)
MsgBoxStyle.YesNo = vbYesNo = 4(是、否按钮)
MsgBoxStyle.RetryCancel = vbRetryCancel = 5(重试、取消按钮)
二、可用图标(指定消息框显示哪种图标)
MsgBoxStyle.Critical = vbCritical = 16(错误图标)
MsgBoxStyle.Question = vbQuestion = 32(问号图标)
MsgBoxStyle.Exclamation = vbExclamation = 48(警号图标)
MsgBoxStyle.Information = vbInformation = 64(信息图标)
三、默认按钮(指定消息框的默认按钮)
MsgBoxStyle.DefaultButton1 = vbDefaultButton1 = 0(指定第1个按钮为默认按钮)
MsgBoxStyle.DefaultButton2 = vbDefaultButton2 = 256(指定第2个按钮为默认按钮)
MsgBoxStyle.DefaultButton3 = vbDefaultButton3 = 512(指定第3个按钮为默认按钮)
四、函数返回值MsgBoxResult(指明用户所选择的按钮)
MsgBoxResult.Ok = DialogResult.OK = vbOK = 1(确定按钮)
MsgBoxResult.Cancel = DialogResult.Cancel = vbCancel = 2(取消按钮)
MsgBoxResult.Abort = DialogResult.Abort = vbAbort = 3(放弃按钮)
MsgBoxResult.Retry = DialogResult.Retry = vbRetry = 4(重试按钮)
MsgBoxResult.Ignore = DialogResult.Ignore = vbIgnore = 5(忽略按钮)
MsgBoxResult.Yes = DialogResult.Yes = vbYes=6(是按钮)MsgBoxResult.No = DialogResult.No = vbNo=7(否按钮)

用&连接

C#的MessageBox是分开的,不用& 连接

05-12 12:47