ToString()?

Ok, fine!

From the online help:

public:
static String^ ToString (
    short value
)

My code:

label1->Text = ToString(comboBox1->Items->Count);

The Build Output error message:

error C2661: 'System::Object::ToString' : no overloaded function takes 1 arguments

So, how do I do this

This is a common problem. I need integers, floats... numbers as strings to display on my form! What is the EASY way to do this Show me how to do this for longs, shorts, floats, etc.





Answer this question

ToString()?

  • Tim Noonan

    ToString is a memeber of the type you are using.

    For example:

    int g = 10;
    g.ToString();  //gets you the string "10"

    Search for examples in msdn.microsoft.com and avoid trying to learn the language from the forums.

    Thanks,
      Ayman Shoukry
      VC++ Team



  • ToString()?