473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Overload error

Ant
Hello, I'm a total newbie to .NET & C# so...

When I use Messagebox to show a string & test it, no problems. i then change
the string to an integer, save, rebuild & test & it comes up with this error:

The best overloaded method match for
'System.Windows.Forms.MessageBox.Show(string)' has some invalid arguments.

I understand the concept of overloading properties etc, but how do I get
around this if i simply decide to change the datatype the message box is
displaying. Do I have to delete the messagebox & do it again? - Thank you for
your input. This is probably more of a .NET Q than C# but (?)

off to a slow start

Ant

Nov 17 '05 #1
3 1093
Ant
Me again. Well, I've worked something out. It seems that Messagebox doesn't
have an overload for integers. Can this really be true? Does this mean that
you need to explicitly convert to string, whatever you display with
Messagebox?

Thanks for any input
Ant

"Ant" wrote:
Hello, I'm a total newbie to .NET & C# so...

When I use Messagebox to show a string & test it, no problems. i then change
the string to an integer, save, rebuild & test & it comes up with this error:

The best overloaded method match for
'System.Windows.Forms.MessageBox.Show(string)' has some invalid arguments.

I understand the concept of overloading properties etc, but how do I get
around this if i simply decide to change the datatype the message box is
displaying. Do I have to delete the messagebox & do it again? - Thank you for
your input. This is probably more of a .NET Q than C# but (?)

off to a slow start

Ant

Nov 17 '05 #2
Ant <An*@discussions.microsoft.com> wrote:
Me again. Well, I've worked something out. It seems that Messagebox doesn't
have an overload for integers. Can this really be true? Does this mean that
you need to explicitly convert to string, whatever you display with
Messagebox?


Yes. It's not hard though - just call ToString(). Given that the
message box would just have to convert it to a string anyway, it seems
better to me to have one method call than one for each built-in value
type.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #3
Ant
Thanks very much Jon, You'll probably be seeing a lot more of me here!
regards
Ant

"Jon Skeet [C# MVP]" wrote:
Ant <An*@discussions.microsoft.com> wrote:
Me again. Well, I've worked something out. It seems that Messagebox doesn't
have an overload for integers. Can this really be true? Does this mean that
you need to explicitly convert to string, whatever you display with
Messagebox?


Yes. It's not hard though - just call ToString(). Given that the
message box would just have to convert it to a string anyway, it seems
better to me to have one method call than one for each built-in value
type.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Piotre Ugrumov | last post by:
I have tried to implement the overload of these 2 operators. ostream & operator<<(ostream &out, Person &p){ out<<p.getName()<<" "<<p.getSurname()<<", "<<p.getDateOfBirth()<<endl; return out; }...
1
by: Piotre Ugrumov | last post by:
I'm following your help. I have written the overload of the operator <<. This overload work! :-) But I have some problem with the overload of the operator >>. I have written the overload of this...
3
by: Piotre Ugrumov | last post by:
I have done the overload on the operator >> and << in the class Attore. These 2 overload work correctly. I have done the overload of the same overload in the class Film. The class film ha inside...
7
by: Sean | last post by:
Can someone help me see why the following "operator=" overloading doesn't work under g++? and the error message is copied here. I see no reason the compiler complain this. Thanks, $ g++...
10
by: Benny Raymond | last post by:
I'm trying to change the way a treeview works just a bit, i'm pretty new to C# and now i'm running into overloading. I tried the following code and it's yelling at me saying that no overload...
1
by: Peteroid | last post by:
Ok, what am I do wrong here. I created a class with a public method, and when I try to create a new overload of it in a derived child class it won't let me: class Parent_Class { public: long ...
0
by: Eph0nk | last post by:
Hi, I get an overload resolution failed error (Overload resolution failed because no accessible 'New' can be called without a narrowing conversion), and I can't seem to find a lot of relevant...
2
by: Michi Henning | last post by:
Hi, the following code produces an error on the second-last line: Interface Left Sub op() End Interface Interface Right Sub op(ByVal i As Integer)
9
by: Tony | last post by:
I have an operator== overload that compares two items and returns a new class as the result of the comparison (instead of the normal bool) I then get an ambiguous operater compile error when I...
5
by: phiefer3 | last post by:
I'm currently a student, but this problem isn't directly related to what I have to do on an assignment. It's just a problem I've had with some supporting features. First of all, I'm using MSVS...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.