Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerate dialog result from a custom message box class
    text
    copied!<p>I am developing a custom messagebox class like the following-</p> <pre><code>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 </code></pre> <p>Those functions are designed with related graphics, color, title and heading.</p> <p>btnOk will return DialogResult.Ok, btnNo will return DialogResult.No and btnYes will return DialogResult.Yes</p> <p>How do i return the dialog result with those functions?</p> <p>How do i know that which button is pressed?</p> <p>i dont know how to handle a button click event in a formless class.</p> <p>Would you give me the idea?</p> <p>Thank you in advance.</p> <p>SKPaul</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload