469,300 Members | 2,176 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,300 developers. It's quick & easy.

How to display message box using c#

nirmalsingh
218 100+
what are the things i shoul import?.. and how could i display a message box in c#? sample code will help me a lot.....
Dec 14 '06 #1
7 69275
what are the things i shoul import?.. and how could i display a message box in c#? sample code will help me a lot.....
hi...
u can have messageboxes displayed in C#...
for that u have to import System.Runtime.InteropServices
like
using System.Runtime.InteropServices;

then within ur class, write

[DllImport("User32.dll")]
public static extern int MessageBox(int h, string m, string c, int type);

now u can easily call the function MessageBox()....
Hope this will help u..
thanks...
Dec 14 '06 #2
If it is windows applications you can directly call the function MessageBox.Show("hello");

The above function
if it is webapplication you have to use javascript fumction to get messageBox
I hope it is clear.
Dec 16 '06 #3
hi...
u can have messageboxes displayed in C#...
for that u have to import System.Runtime.InteropServices
like
using System.Runtime.InteropServices;

then within ur class, write

[DllImport("User32.dll")]
public static extern int MessageBox(int h, string m, string c, int type);

now u can easily call the function MessageBox()....
Hope this will help u..
thanks...
I have tried this code but it's not working, reply plz....why?
Jan 2 '07 #4
hi...
u can have messageboxes displayed in C#...
for that u have to import System.Runtime.InteropServices
like
using System.Runtime.InteropServices;

then within ur class, write

[DllImport("User32.dll")]
public static extern int MessageBox(int h, string m, string c, int type);

now u can easily call the function MessageBox()....
Hope this will help u..
thanks...
I wants to use skin file in c#. Wheather this fascility is available in the c# plz... reply.
Jan 2 '07 #5
I have tried this code but it's not working, reply plz....why?
please check ur code once more...
have u called d MessageBox function wid d rigt no. of parameters?
also remember to include

[DllImport("User32.dll")]
public static extern int MessageBox(int h, String s, String s1, int type);

in d global variable declaration section( within class, out side member functions)

then u must get d function ready 2 b called...
u can call it by having arguements 'h' and 'type' as 0...
s is d msg to b displayed and s1 is the title...give some strings for those params...

hope dis will help u..
thanx and rgrds...
sand...
Jan 2 '07 #6
I wants to use skin file in c#. Wheather this fascility is available in the c# plz... reply.
Yeah...it's possible...u can have d skin files added in ur pjt...
u can put the skin files in d " App_Themes" folder...
thanx and rgrds..
sand...
Jan 6 '07 #7
what are the things i shoul import?.. and how could i display a message box in c#? sample code will help me a lot.....
If you are using c# in asp.net then make javascript function in codebehind and register it with codebehind and call where u need it.
Example:-
private void MsgBox(string msg)
{
string showMsg = "<script language='javascript'>" +
"alert("+msg+");</script>";
RegisterStartupScript("ds",msg);
string str = "<script language='javascript'>" ;
str = str + "alert('" + msg + "' )" ;
str = str + "</script>";
RegisterStartupScript("ds",str);

}

Dhananjay Singh
Jan 6 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Mamatha | last post: by
1 post views Thread by Duppypog | last post: by
13 posts views Thread by Benjamin Smith | last post: by
8 posts views Thread by Taras_96 | last post: by
2 posts views Thread by anoop | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.