windows窗体c++;读取file.txt并填写文本框

windows窗体c++;读取file.txt并填写文本框,file,io,c++-cli,File,Io,C++ Cli,好的,我有5个文本框,我使用StreamWriter类将文本框的文本保存到一个.txt文件中 但是我无法将文本从.txt文件检索回文本框,知道怎么做吗 嗯,这就是我写入.txt文件的方式 String^ writedata = textBox1->Text +";" + textBox2->Text + ";" + textBox3->Text + ";" +

好的,我有5个文本框,我使用StreamWriter类将文本框的文本保存到一个.txt文件中

但是我无法将文本从.txt文件检索回文本框,知道怎么做吗

嗯,这就是我写入.txt文件的方式

String^ writedata = textBox1->Text +";" + 
                    textBox2->Text + ";" + 
                    textBox3->Text + ";" + 
                    textBox4->Text + ";" + 
                    textBox5->Text + ";" + 
                    textBox6->Text + ";" + 
                    textBox7->Text + ";" + 
                    textBox8->Text;

StreamWriter^ SR = gcnew StreamWriter("C:\\Settings.txt");

SR->Write(writedata);

SR->Close();

我认为您可以将文件读入一个字符串,然后使用终止字符“;”拆分该字符串

您可能应该将此[c++-cli]标记为[c++],而不是[c++]如何尝试读回不起作用的文本?请尝试{StreamReader*sr=new StreamReader(“c:\\test1.txt”);StreamReader reader=new StreamReader(textFile);do{textBox1->text=(reader->ReadLine());}while(reader->->Peek()!=-1);}catch(系统::异常^e){textBox1->Text=“error”;}