Question

How do you get a class to interact with the form to show a message box?

Was it helpful?

Solution

using System.Windows.Forms;
...
MessageBox.Show("Hello World!");

OTHER TIPS

System.Windows.MessageBox.Show("Hello world"); //WPF
System.Windows.Forms.MessageBox.Show("Hello world"); //WinForms

Try this:

System.Windows.Forms.MessageBox.Show("Here's a message!");
using System.Windows.Forms;

public class message
{
    static void Main()
    {  
        MessageBox.Show("Hello World!"); 
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top