// JP opened flex table

Click to See Complete Forum and Search --> : Textbox to file


usingnamespace
March 2nd, 2008, 05:46 PM
I have been trying to save data from textbox into a file with no success.
Does anyone have any suggestions? I'm using CLR WinForm.

somu0915
March 3rd, 2008, 03:43 AM
Use System::IO namespace with StreamWriter() method.
Sample Example:

String^ str = this->Textbox1->Text;
System::IO::StreamWriter^ sw = gcnew System::IO::StreamWriter(fileName);
sw->WriteLine(str);
sw->Close();

usingnamespace
March 4th, 2008, 04:45 PM
Thanks, that worked perfectly!

Now I have to read data from file, back into textboxes. Each line into its own, but can't find the solution.
Also I would need to add text to file, this method overwrites the file.

somu0915
March 6th, 2008, 03:42 AM
Just like there is a StreamWriter() method, .NET has a StreamReader() method as well for reading text..
Try that..
Goto online msdn documentation for more help..

usingnamespace
March 8th, 2008, 04:22 PM
I couldn't find any usefull StreamReader() information for VC++ most of it was for VB, and C# and I'm having trouble transfering it into VC++.
Could anyone help me with the an example please?

//JP added flex table