VB.Net Message Box: Types of MessageBox


The VB.Net Message Box displays a dialog box that interrupts the user. It immediately blocks further interaction with Windows Form.

Different Types of VB.Net Message Box

There are different types of MessageBoxes in VB.Net some of them are given below.

Example 1:

To show message box use the following piece of code.

VB.Net Message Box

MessageBox.Show( "Your Message Here" )

VB.Net Message Box

Example 2:

Message Box with caption and OK button.

MessageBox.Show("Your Message Here", "Caption")

VB.Net Message Box

Example 3:

Message Box with OK, Cancel buttons and Stop Icon.

MessageBox.Show("Your Message Here", "Caption", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop)

VB.Net Message Box

Example 4:

Message Box with Yes, No, Cancel Buttons and Asterisk icon.

MessageBox.Show("Your Message Here", "Caption", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk)

VB.Net Message Box

Example 5:

Message Box with Retry, Cancel buttons and Warning icon.

MessageBox.Show("Your Message Here", "Caption", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning)

VB.Net Message Box

You may try the various type of message boxes VB.net provides.