Click here to Skip to main content
15,913,669 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
this gives 2 errors,
1)The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string, string)' has some invalid arguments

2)The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string, string)' has some invalid arguments
pls can any one tell me what is wrong in this and how i can fix it.

MessageBox.Show("you dont have not selected any candidate yet",MessageBoxIcon.Exclamation);

thanx!!
Posted

The MessageBox.Show() method is an overloaded method either accepting two or three method parameters.

With two parameters, both should be string, and represent specified text and message box caption.

With three parameters, there would be two strings and a third message box icon.

What you are doing is using two parameters, but the second one is an icon when a string is expected (as the first overload is used automatically with two parameters).

Try MessageBox.Show("you dont have not selected any candidate yet",string.Empty,MessageBoxIcon.Exclamation);

Your message box caption will be empty, but otherwise your code should work fine.
 
Share this answer
 
v2
Comments
Uday P.Singh 5-Jul-11 13:15pm    
my 5!
Abhinav S 5-Jul-11 13:22pm    
Thank you.
Sergey Alexandrovich Kryukov 5-Jul-11 14:21pm    
Correct, my 5. Not sure OP deserves it -- please see my answer.
--SA
Abhinav S 5-Jul-11 14:40pm    
Thanks.
I guess programming is only for those who can read, not only write:
http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox.aspx[^].

It does not need any explanations.

—SA
 
Share this answer
 
v2
Comments
Abhinav S 5-Jul-11 14:41pm    
Good link. 5.
Sergey Alexandrovich Kryukov 5-Jul-11 14:56pm    
Thank you, Abhinav.
--SA
Wonde Tadesse 5-Jul-11 21:02pm    
5+. Well said.
Sergey Alexandrovich Kryukov 5-Jul-11 21:48pm    
Thank you, Wonde.
--SA
Member 7779792 6-Jul-11 3:13am    
thank you!! it is actually a good link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900