How do I create a MessageBox in C# ?

Posted by Nick Stinemates on Stack Overflow See other posts from Stack Overflow or by Nick Stinemates
Published on 2008-09-08T04:00:54Z Indexed on 2010/05/27 6:31 UTC
Read the original article Hit count: 223

Filed under:
|

I have just installed C# for the first time, and at first glance it appears to be very similar to VB6. I decided to start off by trying to make a 'Hello, World!' UI Edition.

I started in the Form Designer and made a button named "Click Me!" proceeded to double-click it and typed in

MessageBox("Hello, World!");

I received the following error:

MessageBox is a 'type' but used as a 'variable'

Fair enough, it seems in C# MessageBox is an Object. I tried the following

MessageBox a = new MessageBox("Hello, World!");

I received the following error: MessageBox does not contain a constructor that takes '1' arguments

Now I am stumped. Please help.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET