Jump to content
Tuts 4 You

Msgbox Samples For Vb.net


CodeExplorer

Recommended Posts

CodeExplorer
Posted (edited)

Msgbox Samples For Vb.net

MessageBox OK:

MessageBox.Show("message", "caption", MessageBoxButtons.OK, MessageBoxIcon.Hand)

MessageBox AbortRetryIgnore:

Dim answer = MessageBox.Show("message", "caption", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Hand)

If answer = DialogResult.Abort Then

' Do abort processing here...

ElseIf answer = DialogResult.Retry Then

' Do retry processing here...

Else 'It has to be ignore

' Do ignore processing here...

End If

MessageBox OKCancel:

Dim answer = MessageBox.Show("message", "caption", MessageBoxButtons.OKCancel, MessageBoxIcon.Hand)

If answer = DialogResult.ok Then

' Do ok processing here...

Else 'It has to be cancel

' Do cancel processing here...

End If

MessageBox RetryCancel:

Dim answer = MessageBox.Show("message", "caption", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand)

If answer = DialogResult.Retry Then

' Do Retry processing here...

Else 'It has to be cancel

' Do cancel processing here...

End If

MessageBox YESNO:

Dim answer = MessageBox.Show("message", "caption", MessageBoxButtons.YesNo, MessageBoxIcon.Hand)

If answer = DialogResult.Yes Then

' Do Yes processing here...

Else 'It has to be cancel

' Do No processing here...

End If

MessageBox YesNoCancel:

Dim answer = MessageBox.Show("message", "caption", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Hand)

If answer = DialogResult.Yes Then

' Do Yes processing here...

ElseIf answer = DialogResult.No Then

' Do No processing here...

Else 'It has to be cancel

' Do ignore processing here...

End If

Edited by CodeRipper
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...