I have a windows form with two butttons and a text box. My start button reads the first line in the csv file and outputs the data I want into a textbox:
private: System::Void StartBtn_Click(System::Object^ sender, System::EventArgs^ e)
{
String^ fileName = "same_para_diff_uprn1.csv";
StreamReader^ din = File::OpenText(fileName);
String^ delimStr = ",";
array<Char>^ delimiter = delimStr->ToCharArray( );
array<String^>^ words;
String^ str = din->ReadLine();
words = str->Split( delimiter );
textBox1->Text += gcnew String (words[10]);
textBox1->Text += gcnew String ("
");
textBox1->Text += gcnew String (words[11]);
textBox1->Text += gcnew String ("
");
textBox1->Text += gcnew String (words[12]);
textBox1->Text += gcnew String ("
");
textBox1->Text += gcnew String (words[13]);
Then my 'next button' I want it to clear the text box, and display the next lines data as above. Then everytime the next button is cliced, the textbox is cleared and the next line of the csv file is shown. Until I get to the end of the file. How would I manage that?
TIA
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…