String error in Visual studio 2010

Write your question here.
Dear All,

I am a new user to VS. With a short in VS2010:

label2->Text=System::Convert::toString(r);


I got the error message:
" error C2039: 'toString' : is not a member of 'System::Convert'"
error C3861: 'toString': identifier not found"

Is there any problem with my compiler please?

Thanks in advance.

--Muguangde


 
   label2->Text=System::Convert::toString(r);
It should be uppercase T in ToString.
My fault. Many thanks. Just a newbe.
Looks like you are using C++/CLI. Are you sure you created the right type of project?
I tried to create a console C++/CLI project and typed this, which worked:

#include "stdafx.h"

using namespace System;

int main(array<System::String ^> ^args)
{
String ^s = Convert::ToString(5);
Console::WriteLine(s);
return 0;
}

Notice the case sensitivity and the ^ character for managed datatypes.
If you dont know what these are I reccommend you look at Ivor Horton's Beginning Visual C++.
In any case the example I put up above is not "standard C++".
Topic archived. No new replies allowed.