pass string in backgroundworker

How do you pass a string from backgroundworkers dowork to it's
progresschanged? I can pass an integer easily and then print it
out with e->progresspercentge....but I can't do it with a string!
:| can we get some code?
or at least anything specific to work with.

what you said was too general and I dont understand what you need .
Here is a basic version of what i'm looking to do:

private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) {

StreamReader^ sr = gcnew StreamReader("NAMES.txt");
String^line;

for (test = 0; test < 20000; test++)
{

line = sr->ReadLine();
backgroundWorker1->ReportProgress(line);
}
}


private: System::Void backgroundWorker1_ProgressChanged(System::Object^ sender, System::ComponentModel::ProgressChangedEventArgs^ e) {

textBox2->AppendText(line);

}


obviously I can't pass the string 'line' to progress. I was wondering how to do that.
I'm not sure about c++, but in c# the ReportProgress method is overloaded where it can pass a percentage and a "UserState" which is just an object that is part of ProecessedChangedEventArgs.

Hope this helps,
-John
Topic archived. No new replies allowed.