1
Just as a matter of interest it's possible to use VB.Net's MsgBox function from C# as the following example shows:
/* add a reference to Microsoft.VisualBasic.dll to your project */
using System;
using Microsoft.VisualBasic;
class Test
{
static void Main()
{
string msg = "Do you want to use VB's MsgBox from C#?";
MsgBoxStyle style = MsgBoxStyle.YesNo;
string title = "Choose option";
MsgBoxResult result = Interaction.MsgBox(msg, style, title);
if (result == MsgBoxResult.Yes)
{
Console.WriteLine("OK, you're using it!");
}
else
{
Console.WriteLine("Then use System.Windows.Forms.MessageBox.Show instead.");
}
Console.ReadKey();
}
}
However, there's little point in doing so unless you're also using another VB.Net function such as InputBox which doesn't have a convenient alternative in the System.Windows.Forms namespace.
0
Hi Raghu,
following is the syntax to use message box in C#
messagebox.show();
in VB
MsgBox("Welcome to Microsoft Visual Basic")
Thanks,
Prasant
0
Hi Raghu,
Please refer the below links
http://www.dotnetperls.com/messagebox-show
http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox%28v=vs.71%29.aspx
Thanks
If this post helps you mark it as answer