Show a message box from a class in c#?

后端 未结 4 1362
栀梦
栀梦 2021-01-07 16:55

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

相关标签:
4条回答
  • 2021-01-07 17:24
    using System.Windows.Forms;
    
    public class message
    {
        static void Main()
        {  
            MessageBox.Show("Hello World!"); 
        }
    }
    
    0 讨论(0)
  • 2021-01-07 17:26

    Try this:

    System.Windows.Forms.MessageBox.Show("Here's a message!");
    
    0 讨论(0)
  • 2021-01-07 17:41
    System.Windows.MessageBox.Show("Hello world"); //WPF
    System.Windows.Forms.MessageBox.Show("Hello world"); //WinForms
    
    0 讨论(0)
  • 2021-01-07 17:44
    using System.Windows.Forms;
    ...
    MessageBox.Show("Hello World!");
    
    0 讨论(0)
提交回复
热议问题