R
rollasoc
Hi,
Having a slight problem with how to pass parameters to functions between
threads.
I have a form with a progress bar and a description label on it. It has a
public function
IncrementProgressBar() that just calls performstep on the progress bar.
On my main form I create a thread which creates the progress bar form
Then using
MethodInvoker mi = new MethodInvoker(m_ProgressBar.IncrementProgressBar);
this.BeginInvoke(mi);
I can get this function called wherever is appropriate.
All is fine. But I want a function that takes a string as a parameter so I
can dynamically update the description.
Any idea how to do this? I've searched google and found nothing so far.
I've tried
MethodInvoker mi = new MethodInvoker(m_ProgressBar.UpdateDescription);
object[] args = {m_txtUpdateDescription.Text};
this.BeginInvoke(m_ProgressBar.UpdateDescription, args);
but the first line doesn't compile.
Actually it gives a compiler error (which I'm assuming from other messages
I've seen on google is a bug in the compiler).
Any idea how to get the delegate to wotk with parameters?
Rollasoc
Having a slight problem with how to pass parameters to functions between
threads.
I have a form with a progress bar and a description label on it. It has a
public function
IncrementProgressBar() that just calls performstep on the progress bar.
On my main form I create a thread which creates the progress bar form
Then using
MethodInvoker mi = new MethodInvoker(m_ProgressBar.IncrementProgressBar);
this.BeginInvoke(mi);
I can get this function called wherever is appropriate.
All is fine. But I want a function that takes a string as a parameter so I
can dynamically update the description.
Any idea how to do this? I've searched google and found nothing so far.
I've tried
MethodInvoker mi = new MethodInvoker(m_ProgressBar.UpdateDescription);
object[] args = {m_txtUpdateDescription.Text};
this.BeginInvoke(m_ProgressBar.UpdateDescription, args);
but the first line doesn't compile.
Actually it gives a compiler error (which I'm assuming from other messages
I've seen on google is a bug in the compiler).
Any idea how to get the delegate to wotk with parameters?
Rollasoc