Providing user feedback in windows forms

R

Rykie

I am primarily a web developer, but have to develop this windows app.
It works a treat, but it has some places where it lags and some long
running processes, which I want to provide user feedback to the user
from.

I want to open a seperate windows form with an animation on it and a
label that is public so i can change the text on it as the process
progresses, but all I get is a blank form until the process is done.

Can someone please provide me with some sample code how to open a form
like this. I tried threading, but kep getting cross thread errors.

thanks,
ryk
 
J

james

Rykie said:
I am primarily a web developer, but have to develop this windows app.
It works a treat, but it has some places where it lags and some long
running processes, which I want to provide user feedback to the user
from.

I want to open a seperate windows form with an animation on it and a
label that is public so i can change the text on it as the process
progresses, but all I get is a blank form until the process is done.

Can someone please provide me with some sample code how to open a form
like this. I tried threading, but kep getting cross thread errors.

Are you trying to do the new form as the second thread? I think in a
situation like this you really need to be sub-threading the operation that
is taking some time, the popup animation form would then run in the same
thread as the main form and display correctly.

I just put a time-consuming operation in it's own method then start that as
a new thread:

Thread tWork = new Thread(new ThreadStart(worker));
tWork.Start();
frmProgress pForm = new frmProgress();
pForm.Show();

private void worker()
{
//do busy stuff here
}


Thats sort of how I'd do it - you'd need to work out how to get rid of the
popup form of course... the cross thread errors you get will probably occur
as a result of you trying to modify something on the form from a sub thread
or similar - this generally causes troubles.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top