winforms - Passing/Keeping/Returning String From Form/Dialog - C++ /CLI -
i trying pass reference string form shows dialog user input , pass input string out. have followed several other questions on , can not syntax work.
the form/dialog call looks like:
public ref class singlestringui : public system::windows::forms::form { public: system::string^ tuserinput; public: singlestringui(void) { initializecomponent(); } singlestringui(system::string ^% userinput) { initializecomponent(); tuserinput = userinput; } private: system::void singlestringokbutton_click(system::object^ sender, system::eventargs^ e) { tuserinput = gcnew ystem::string(this->singlestringtextbox->text); }
the caller looks like:
sv8::singlestringui^ testmatch; system::string^ userinput; testmatch = (gcnew sv8::singlestringui(userinput));
however, when run this, string entered textbox not returned caller. other examples have seen indicate problem when store local copy in tuserinput. on getting copy of string out of textbox appreciated.
re-assigning tuserinput
in singlestringokbutton_click
not change userinput
because tuserinput
handle userinput
, not tracking reference handle. opportunity change userinput
in singlestringui
constructor. provide accessor string textbox instead.
Comments
Post a Comment