Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

VisualStudio how to click button and do something

Public Class Form1

Private Sub btnhello_Click(sender As Object, e As EventArgs) Handles btnhello.Click
    If MessageBox.Show("click anything", "error box", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Abort Then
        MessageBox.Show("aborted")

    ElseIf DialogResult.Retry Then
        MessageBox.Show("retry done")
    End If
End Sub
End Class

in the Else If i want to do when i click Retry button display retry done

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can use a Select…Case Statement to handle the different DialogResult values MessageBox.Show can return:

Select Case MessageBox.Show("click anything", "error box", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question)
    Case DialogResult.Abort
        MessageBox.Show("aborted")
    Case DialogResult.Retry
        MessageBox.Show("retry done")
    Case DialogResult.Ignore
        MessageBox.Show("ignore")
End Select
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading