visual c++ - Changing the text of a C++ CLI label -


i trying change text of label in c++ cli program. need take value the user entered in textbox, insert short string, change label string. have no problem constructing string, having trouble setting label new string. here code...

std::string v1str = "phase a: "; v1str.append(vt2); //vt2 type str::string v1str.append(" vac"); label->text = v1str; 

this error message i'm getting...

enter image description here

why not allowed pass v1str label text setter? how can pass string i've constructed label text setter?

label::text has type of system::string^, managed .net string object. cannot assign std:string system::string^ directly becuase different types.

you can convert std::string system::string. want use system::string type directly:

system::string^ v1str = "phase a: "; v1st += vt2; // or maybe gcnew system::string(vt2.c_str()); v1str += " vac"; label->text = v1str; 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -