Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Really simple question on 'msgbox'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
COHENMARVIN@lycos.com - 22 Mar 2008 14:01 GMT
I'm a VB programmer, learning C#.  How does one do the equivalent of a
"msgbox" (from Visual Basic) in C#?   Is there something like this:
               System.Forms.MessageBox("Hello World");
Thanks,
Marvin
Gilles Kohl [MVP] - 22 Mar 2008 14:34 GMT
Hi Marvin,

>I'm a VB programmer, learning C#.  How does one do the equivalent of a
>"msgbox" (from Visual Basic) in C#?   Is there something like this:
>                System.Forms.MessageBox("Hello World");
>Thanks,
>Marvin

You almost guessed it alreadyt:

System.Windows.Forms.MessageBox.Show("Hello World");

(don't forget the semicolon :-)

Btw., don't worry - you won't have to retype that lengthy namespace, just add

using System.Windows.Forms;

at the top of your .cs file, if the "New Project" wizard did not do that for
you already.

Then, just use e.g.

  MessageBox.Show("Hello World");

(There's lots of alternatives btw, if you are using Visual Studio, try opening
the curling brace after typing "Show" and srcoll through them with cursor up
and down)

Have fun with C#!

  Regards,
  Gilles.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.