I have a program like this that I made.
As you can see it reads the first line of the file and breaks it at each white space into a separate string. I wanted to transform this into a win forms app but I have run into a issue.Code:outfile.open ("ImportUsers.txt"); if (infile.good()) { while (!infile.eof()) { infile >> First >> Rank >> Last;// Saves the line in STRING. cout << "dn: CN=" << First << " " << Rank << " " << Last << dcClass << endl;
How can I do that same thing here? I am lost.Code:public: System::Void convertToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { StringBuilder^ sb = gcnew StringBuilder(); Convertor^ form2 = gcnew Convertor(); if(listBox1->Items->Count > 0){ for (int i = 0; i < listBox1->Items->Count; i++){ String^ temp = listBox1->Items[i]->ToString(); sb->AppendFormat("{0}", temp)->AppendLine(); } sb->Length = sb->Length - 1; form2->textBox1->Text = sb->ToString(); form2->ShowDialog(); } else { MessageBox::Show("You must open a file before converting it!", "Error"); } }


Reply With Quote
Bookmarks