Click to See Complete Forum and Search --> : How to get TextBox Value??


kennis
January 21st, 2005, 04:35 PM
i have a textbox and a button in a form

when i clic at button i need to get the textbox value, my textbox name is txtName

----------------------------------
using namespace std;
string a;
a=txtName->Text->toString;
--------------------------------------
BUT IT HAS ERROR WHEN I COMPILED

another question,
i know that every class need a .h (declarations) and .cpp(implementations), but i dunno much about c++ in windows aplication, which codes goes to .cpp in this case?

thanks your help

coder0xff
January 21st, 2005, 06:44 PM
The Text property is already a string and doesn't need conversion. This should work:

a=txtName->Text;

For future reference, ToString would need parenthesis after it because it is a function call:

destination=source->ToString();

For conversion I usually use:

destination=System::Conversion::ToString(source);