Click to See Complete Forum and Search --> : Storing text from a textBox


markwalker84
July 10th, 2006, 11:39 AM
Hi there!


I'm sure this is VERY simple but could someone please point me in the right direction (or tell me?? hehe) how to take the text entered in a text box and then save it for use in the programme at a later date. ie as a member of a char / string array.

I want to take what is written in a text box and add it to the next location in something like;

std::string tractor_name[];

or

char tractor_name[][30];


All help is greatly appreciated!


Mark

P.S. there is a bit more detail at this link : http://www.codeguru.com/forum/showthread.php?t=393393&page=1&pp=15

It seems i posted in the wrong place to begin with! oops!

ThermoSight
July 10th, 2006, 05:02 PM
If it's a .NET Windows Forms application, I think that all you have to do is ask for the text, sorta like this ....


String *pStg = textBox1->Text;


or,


String *pThreadState[];

pThreadState = new String* __gc[9];

pThreadState->Item[j++] = textBox1->Text;



You can test the length with "textBox1->Text->Length" ....

where 'textBox1' is whatever you've named the text box in your form.

It's essentially a String *, so there's a million things ya can do with it, a million methods/properties you can apply ... IF YOU"RE USING C++ .NET. If not, I apologize for wasting your time.

My advice? Just type "text box" in the 'help' section of the IDE and read all about the class. MS has done a *magnificent* job of placing tons of information at your fingertips, if only you'll use the tools they've provided.


The statements may not be entirely correct, I think you've stated you're using 2005 whereas I'm familiar with 2003, but the concept probably remains the same.

Good luck.

bill