im currently making a save function for my Project wich is like this :

private: System::Void Form1_FormClosing(System::Object^  sender, System::Windows::Forms::FormClosingEventArgs^  e) 
			 	String^Sleeptime = textBox4->Text;
	                        StreamWriter^ sWriter = gcnew StreamWriter("c:\\DoNotEdit !.txt");


And this for the load function:

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) 

		        if ( File::Exists("c:\\DoNotEdit !.txt") )
			StreamReader^ myFile = File::OpenText("c:\\DoNotEdit !.txt");  
                        Form1::textBox4->Text = myFile->ReadLine();

            	StreamWriter^ sWriter = gcnew StreamWriter("c:\\DoNotEdit !.txt");

But now im trying to save and load the color picked of a ColorDialog.
(The user can choose a Color and the background of the form becomes the picked color)

I tryed some stuff, but it all didn't worked.
So what should is use to get it working ?
Help is greatly appreciated !

Edited 5 Years Ago by Danny1994: n/a

Thanks for you replay :)
But im quite new to this.
I wonder how i could make a function wich writes the color as plain text.

this->comboBox1->ForeColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(255)), static_cast<System::Int32>(static_cast<System::Byte>(192)),static_cast<System::Int32>(static_cast<System::Byte>(192)));

For example that color ?

Oh, well, that's even easier. Just write out the RGB values as text and read them back in again.

int firstnum = 255;
sw->WriteLine(firstNum.ToString()+" "+secondNum.ToString()+" "+thirdNum.ToString());

Read the line back in and parse the numbers out from the string to get them back.

Edited 5 Years Ago by jonsca: ToStringing

This article has been dead for over six months. Start a new discussion instead.