I have the following snippets of a working code which I call from a VB6 app. The ONLY exposed function is the void Run() function. The function uses the backgroundWorker and I can easily see the result of the process using e.Result in backgroundWorker_RunWorkerCompleted. So, if I call Run() from VB6 then all is going perfect, but I cannot return that value of e.Result to the VB6 caller. I also cannot use string Run() cause I have nothing to return in Run().
public void Run(string param)
{
backgroundWorker.RunWorkerAsync(argument: param);
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
e.Result = "Done!";
}
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
string result = (string)e.Result;
}
How can I return the final string (e.result) to the calling void Run()? I can't just use the e.result because I'm calling the "Run()" from the VB6 app, and I'm expecting to get the returned result in there.
Thanks for your help...