winform messagebox 统一

vb.net 里面有两种messagebox,一种是vb语言提供的msgbox,另一种是.net framework 提供的messagebox.在此统一使用messagebox.

 

Warning,提示警示信息:

MessageBox.Show("You are not allowed to enquiry!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

 

Error, 提示错误信息:

处理出错,或者出现异常的时候

MessageBox.Show(objEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

 

Information,显示消息:

MessageBox.Show("Created successfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)

 

Alert, 询问信息:

Dim objResponse As MsgBoxResult
objResponse = MessageBox.Show(

"No record found!" & vbCrLf & "Do you want to create new record?",

"Alert",

MessageBoxButtons.OKCancel,

MessageBoxIcon.Exclamation)
If objResponse = MsgBoxResult.Ok Then
       btnCreate.Enabled = True
End If

posted @ 2015-05-08 09:17  breezesit  阅读(220)  评论(0编辑  收藏  举报