Reputation: 9101
How do you get a class to interact with the form to show a message box?
Upvotes: 30
Views: 135595
Reputation: 49564
using System.Windows.Forms;
...
MessageBox.Show("Hello World!");
Upvotes: 41
Reputation: 422252
System.Windows.MessageBox.Show("Hello world"); //WPF
System.Windows.Forms.MessageBox.Show("Hello world"); //WinForms
Upvotes: 15
Reputation: 22705
Try this:
System.Windows.Forms.MessageBox.Show("Here's a message!");
Upvotes: 4
Reputation: 38428
using System.Windows.Forms;
public class message
{
static void Main()
{
MessageBox.Show("Hello World!");
}
}
Upvotes: 3