Public Class MyCustomMsgBox Private MyForm As Form = New Form Private lblHeadline As Label = New Label Private lblMessageBody As Label = New Label Private btnNo As Button = New Button Private btnOk As Button = New Button Private btnYes As Button = New Button Public Sub New(ByVal Message As String) With MyForm .Width = 438 .Height = 214 .Controls.AddRange(New Control() {lblHeadline, lblMessageBody, btnNo, btnYes, btnOk}) End With End Sub Public Shared Function ShowErrorMsg(ByVal ErrorMessage As String) As Windows.Forms.DialogResult Dim obj As MyCustomMsgBox = New MyCustomMsgBox(ErrorMessage) obj.MyForm.ShowDialog() End Sub Public Shared function ShowSuccessMsg(ByVal SuccessMessage As String) As Windows.Forms.DialogResult 'some code End Sub Public Shared Function AskQuestions(ByVal Questions As String) As Windows.Forms.DialogResult 'some code End Sub Public Shared Function ShowExceptions(ByVal ExMessage As String) As Windows.Forms.DialogResult 'some code End Sub 'Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click ' Windows.Forms.DialogResult.No() 'End Sub End Class
Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click Me.DialogResult = DialogResult.No End Sub
MyCustomMsgBox
ShowErrorMsg
obj.MyForm.ShowDialog()
System.Windows.Forms.DialogResult
System.Windows.Forms.Form.DialogResult
MyForm
ShowSuccessMsg
obj
DialogResult
ShowMessage
System.Windows.Forms.MessageBoxIcon
System.Windows.Forms.MessageBox.Show
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)