Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

String::Format() doesn't take integer as param object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dilbert - 11 Jul 2005 19:27 GMT
This is the code snippet:
...
int nTest = 10;
String * pMsg = String::Format( "Display an integer here: {0}", nTest);
...

I got the following error message when tried to compile the program:
error C2665: 'System::String::Format' : none of the 5 overloads can convert
parameter 2 from type 'int'

Am I missing anything here?
Willy Denoyette [MVP] - 11 Jul 2005 20:00 GMT
> This is the code snippet:
> ...
[quoted text clipped - 8 lines]
>
> Am I missing anything here?

Please consult the docs before posting, in this case the 2nd argument must
be an object, so you have to box the int.

   ...., __box(nTest));

Willy.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.