Int To String Trouble

Hello , i have a question about Visual C++.

i have an integer value which created with rand() function. I want to show this integer in Textbox about my Form Application. But i have an error like " cannot convert 1 to system::string^ " . I want to convert int to String , but i don't know which function i must use.
This looks like some kind of Managed C++, rather than C++.

The function itoa() will convert an int to a c-style string.

In Managed C++, try this:

1
2
System::String^ str = gcnew System::String("");
str += 1;
Last edited on
Topic archived. No new replies allowed.