I have managed to create a file (Sample.txt).
So what I need now is to put the contents from array (ReadLines[]) to this file, line by line and the file name should be what is written in textBox3.

array<System::String^>^ ReadLines = gcnew array<System::String^> ( textBox2->Lines->Length ); 
ReadLines = textBox2->Lines;

System::String ^ Name1 = textBox3->Text;
System::String ^ Name2 = ReadLines[0];
			
StreamWriter File = gcnew FileStream("C:\\Sample.txt", FileMode::Append);

I have come to a a solution. I have succeded to put all arrayvalues to the .txtfiles with a forloop like this. The only thing I wonder now is how it will be possible to change
path = "c:\\MyTest.txt"

What I want to do is to change MyTest to a name that is written in textBox3. What approach could be taken to do this ?
Thank you...

array<System::String^>^ ReadLines =  gcnew array<System::String^> ( textBox2->Lines->Length ); 
ReadLines = textBox2->Lines;

System::String ^ Name1 = textBox3->Text;
System::String ^ Name2 = ReadLines[0];
			
String^ path = "c:\\MyTest.txt";
		

StreamWriter File = gcnew FileStream(path, FileMode::Append);

for(int count = 0; count < textBox2->Lines->Length; count++)
{
File.WriteLine(ReadLines[count]);
}

I have managed to create a file (Sample.txt).
So what I need now is to put the contents from array (ReadLines[]) to this file, line by line and the file name should be what is written in textBox3.

array<System::String^>^ ReadLines = gcnew array<System::String^> ( textBox2->Lines->Length ); 
ReadLines = textBox2->Lines;

System::String ^ Name1 = textBox3->Text;
System::String ^ Name2 = ReadLines[0];
			
StreamWriter File = gcnew FileStream("C:\\Sample.txt", FileMode::Append);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.