Show a message box from a class in c#?
-
23-08-2019 - |
Question
How do you get a class to interact with the form to show a message box?
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