How to use MsgBox ?

  • Thread starter Thread starter Nicholas Paldino [.NET/C# MVP]
  • Start date Start date
N

Nicholas Paldino [.NET/C# MVP]

Pronto,

MsgBox is a VB function, not a .NET function. In order to get the same
functionality, call the static Show method on the MessageBox class in the
System.Windows.Forms namespace.

Hope this helps.
 
pronto said:
Hi all,

C#.
I create form with single button.
On button push I want to get MsgBox("Hello world").
What I should do to make compiler understand "MsgBox" ?

regards
pronto

using System.Windows.Forms;

MessageBox.Show("Here is your answer...");


Jamie
 
Hi all,

C#.
I create form with single button.
On button push I want to get MsgBox("Hello world").
What I should do to make compiler understand "MsgBox" ?

regards
pronto
 
Interestingly, MessageBox.Show was modelled on VB's MsgBox. If you
examine the parameters and the possible enum values - they correspond
almost one-to-one with VB's MsgBox.

So, it's not that VB's version is so horrible - it's just that .NET
has a virtually identical version, so you might as well use it. But
I'm willing to bet that under the covers you have the *identical*
.net framework code.
 
Back
Top