29

如何让类与表单交互以显示消息框?

4

4 回答 4

40
using System.Windows.Forms;
...
MessageBox.Show("Hello World!");
于 2009-04-03T19:03:07.833 回答
15
System.Windows.MessageBox.Show("Hello world"); //WPF
System.Windows.Forms.MessageBox.Show("Hello world"); //WinForms
于 2009-04-03T19:02:39.253 回答
4

试试这个:

System.Windows.Forms.MessageBox.Show("Here's a message!");
于 2009-04-03T19:01:37.587 回答
3
using System.Windows.Forms;

public class message
{
    static void Main()
    {  
        MessageBox.Show("Hello World!"); 
    }
}
于 2009-04-03T19:01:27.010 回答