Message boxes are often used objects. They are derived form Form Class, displayed modally and used to take user’s acknowledgement and also inform the user or alert the user of any thing that needs to be informed or alerted.
You cannot create a new instance of the System.Windows.Forms.MessageBox class. To display a message box, call the static method System.Windows.Forms.MessageBox.Show. The title, message, buttons, and icons displayed in the message box are determined by parameters that you pass to this method.
The following example shows how to use a System.Windows.Forms.MessageBox to inform the user of a missing entry in a System.Windows.Forms.TextBox.
This example assumes that the method is called from an existing form with a System.Windows.Forms.Button and a System.Windows.Forms.TextBox on it.
Protected Sub button1_Click(sender As Object, e As System.EventArgs)
If textBox1.Text = "" Then
MessageBox.Show("You must enter a name.", "Name Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
' Code to act on the data entered would go here.
End If
End Sub
MessageBox class In VB.NET 2005
Message boxes are often used objects. They are derived form Form Class, displayed modally and used to take user’s acknowledgement and also inform the user or alert the user of any thing that needs to be informed or alerted.
You cannot create a new instance of the System.Windows.Forms.MessageBox class. To display a message box, call the static method System.Windows.Forms.MessageBox.Show. The title, message, buttons, and icons displayed in the message box are determined by parameters that you pass to this method.
The following example shows how to use a System.Windows.Forms.MessageBox to inform the user of a missing entry in a System.Windows.Forms.TextBox.
This example assumes that the method is called from an existing form with a System.Windows.Forms.Button and a System.Windows.Forms.TextBox on it.
Protected Sub button1_Click(sender As Object, e As System.EventArgs)
If textBox1.Text = "" Then
MessageBox.Show("You must enter a name.", "Name Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
' Code to act on the data entered would go here.
End If
End Sub
Profile Answers by GeekAdmin Questions by GeekAdmin
Questions by GeekAdmin answers by GeekAdmin
Related Answered Questions
Related Open Questions