How do you get a class to interact with the form to show a message box?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
using System.Windows.Forms;
...
MessageBox.Show("Hello World!");
回答2:
System.Windows.MessageBox.Show("Hello world"); //WPF
System.Windows.Forms.MessageBox.Show("Hello world"); //WinForms
回答3:
Try this:
System.Windows.Forms.MessageBox.Show("Here's a message!");
回答4:
using System.Windows.Forms;
public class message
{
static void Main()
{
MessageBox.Show("Hello World!");
}
}