Really simple question on 'msgbox'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • COHENMARVIN@lycos.com

    Really simple question on 'msgbox'

    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.Me ssageBox("Hello World");
    Thanks,
    Marvin
  • Gilles Kohl [MVP]

    #2
    Re: Really simple question on 'msgbox'

    Hi Marvin,

    On Sat, 22 Mar 2008 06:01:20 -0700 (PDT), COHENMARVIN@lyc os.com wrote:
    >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.Me ssageBox("Hello World");
    >Thanks,
    >Marvin
    You almost guessed it alreadyt:

    System.Windows. Forms.MessageBo x.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.

    Comment

    Working...