الثلاثاء، 24 ديسمبر 2013

C++ windows label form

I need help getting label1 to display the string that the user inputs.

I know that std::string and System::string are two different types, so I casted the inputted string to String^.

The textbox:

private: System::Void text_box_1(System::Object^ sender, System::EventArgs^ e) { cin >> name; String^ something = gcnew String(name.c_str()); label1->Text = "Name->" + something;

Function that returns string:

string getName() { return name; }

The problem is, label1 always outputs "Name-> blank". What am I doing wrong?


View the original article here

ليست هناك تعليقات:

إرسال تعليق