Hi,
I really don't think you have an option. If you want your main thread
to be free, well... it has to be free! If it's blocked by a call to
fetch data from the database, then it simply isn't going to do
anything until that call returns. The timer calls are returning fine
because they run on worker threads. But as long as the form thread is
blocked, you won't see the updates to the progress bar simply because
the form can't paint itself.
Ideally, you should offload such calls to another thread and keep your
UI thread unblocked at all times. Just remember that if you do choose
to use another thread, then you must use Form.Invoke to update the
progress bar.
"Boniek" <mo****@poczta.onet.pl> wrote in message news:<40******@news.home.net.pl>...
Hi
My main thread is waiting for data from database ( opened Sqlconnection etc)
and my Main Form is also blocked. I have a ProgressBar on Status Bar which
show to a user how percent data is loaded. I use ThreadTimer and Thread but
I can't do anything because when a thread (or ThreadTimer) go to the line
ProgressBar.PefromStep() then it stop on that line. I think it's work like
that because the Main Thread (and main Form) is sleeping.
Can you give me any ideas how I can do that ? Maybe this problem disapear
when I load data in other thread and my Main Thread is free but it doesn't a
good idea.
Thank's all for any help.
Thank's Boniek