mebjen
asked on
How do I suspend the current Thread until progressBar is finished??
Gurus,
I need your help - I have a VB .NET Windows App that loads a form with data and if a certain criteria is met, displays a messageBox to the end-user. If dialogResult = YES then progressBar is displayed and is started (0 to 100 step 10) and after the progressBar is finished, I want to show the end-user another messageBox.
My situation currently however, is when the end-user clicks YES - both the progressBar and the next messageBox are displayed at the same time. Which cause a big proplem since the end-user can click the YES/NO of the second messageBox even though the progressBar isn't finished.
mb
I need your help - I have a VB .NET Windows App that loads a form with data and if a certain criteria is met, displays a messageBox to the end-user. If dialogResult = YES then progressBar is displayed and is started (0 to 100 step 10) and after the progressBar is finished, I want to show the end-user another messageBox.
My situation currently however, is when the end-user clicks YES - both the progressBar and the next messageBox are displayed at the same time. Which cause a big proplem since the end-user can click the YES/NO of the second messageBox even though the progressBar isn't finished.
mb
Use ShowDialog method for the progress bar instead of Show method. HTH
ASKER
ShowDialog doesn't make any difference
Can you paste your source code here?
If the code updating the progress bar is in a seperate thread, then in the first thread before displaying the second message box, do 1 second thread sleeps in a loop until the second thread completes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think
if you want second dialog show after progressbar end it may be
if DialogResult.Yes=MessageBo x.Show("th e first") then
progressBar.Visible=true;
//doing somthing and change the progressbar
MEssageBox.Show("the second")
end if
if you want second dialog show with progressbar and it is a dialog designed by yourself it may be
if DialogResult.Yes=MessageBo x.Show("th e first") then
progressBar.Visible=true;
dim SecondDialog as frmSecond=new frmSecond
SecondDialog.OKBtn.Enabled =false;
SecondDialog.CancelBtn.Ena bled=false ;
SecondDialog.Show();
//doing somthing and change the progressbar
SecondDialog.OKBtn.Enabled =true;
SecondDialog.CancelBtn.Ena bled=true;
end if
if you want second dialog show after progressbar end it may be
if DialogResult.Yes=MessageBo
progressBar.Visible=true;
//doing somthing and change the progressbar
MEssageBox.Show("the second")
end if
if you want second dialog show with progressbar and it is a dialog designed by yourself it may be
if DialogResult.Yes=MessageBo
progressBar.Visible=true;
dim SecondDialog as frmSecond=new frmSecond
SecondDialog.OKBtn.Enabled
SecondDialog.CancelBtn.Ena
SecondDialog.Show();
//doing somthing and change the progressbar
SecondDialog.OKBtn.Enabled
SecondDialog.CancelBtn.Ena
end if
if you want to suspend any work until a thread completes...
use Thread.Join()
(This will finish only when the thread completes)
Cheers...
use Thread.Join()
(This will finish only when the thread completes)
Cheers...
ASKER
idle_Mind,
Thanks - thats exactly what I needed.
mb
Thanks - thats exactly what I needed.
mb