M
Miro
I will try my best to ask this question correctly. I think in the end the
code will make more sence of what I am trying to accomplish. I am just not
sure of what to search for on the net.
I have a form that has a button. ( this form is a child form of a parent
form ( main form ).
Anway...in this child form I have a button, and if clicked a bunch of code
will get executed.
I would like to show a Progress Bar / form in modal/ShowDialog format when
this runs and slowely update the progress bar as each sub runs.
I cant just call the form with fStatus.ShowDialog() cause then all code
stops till this form is closed. So What I am trying is to somehow open this
form in a different thread - in ShowDialog format, so I can continue to run
my code, and as my code runs, update the progress bar on the new status form
created.
At the end, close the status form, and let the user continue on.
As the status form is open, the whole app is 'locked' because of showdialog,
until it is complete.
I hope this makes sence.
Below I have code that I think is in the right direction, but I am at a wall
as I have never done any thread processing.
Thanks for your help,
Miro
'==== some command button _click event on a current form. 'which is a child
form of a mdi form.
'Somewhere here change the icon to be hourglass
Dim fStatus As New frmStatus()
'im pulling code out of my butt for this next line here cause ive
never done this before
Dim Thread1 As New System.Threading.Thread(AddressOf
fStatus.ShowDialog)
Thread1.Start()
'pbStatus is a status bar / progress bar
fStatus.pbStatus.Value += 10 'Increment Push Button
System.Threading.Thread.Sleep(2000) 'Will Call some sub instead later
fStatus.pbStatus.Value += 10
System.Threading.Thread.Sleep(2000) 'Will Call some sub instead later
fStatus.pbStatus.Value += 10
System.Threading.Thread.Sleep(2000) 'Will Call some sub instead later
'Somewhere here change the icon to be pointer again.
'close the form
fStatus.Close()
'im assuming i have to close the thread too or something?
fStatus.Dispose()
'user should have access to the whole app again.
'==== end of some command button _click event
code will make more sence of what I am trying to accomplish. I am just not
sure of what to search for on the net.
I have a form that has a button. ( this form is a child form of a parent
form ( main form ).
Anway...in this child form I have a button, and if clicked a bunch of code
will get executed.
I would like to show a Progress Bar / form in modal/ShowDialog format when
this runs and slowely update the progress bar as each sub runs.
I cant just call the form with fStatus.ShowDialog() cause then all code
stops till this form is closed. So What I am trying is to somehow open this
form in a different thread - in ShowDialog format, so I can continue to run
my code, and as my code runs, update the progress bar on the new status form
created.
At the end, close the status form, and let the user continue on.
As the status form is open, the whole app is 'locked' because of showdialog,
until it is complete.
I hope this makes sence.
Below I have code that I think is in the right direction, but I am at a wall
as I have never done any thread processing.
Thanks for your help,
Miro
'==== some command button _click event on a current form. 'which is a child
form of a mdi form.
'Somewhere here change the icon to be hourglass
Dim fStatus As New frmStatus()
'im pulling code out of my butt for this next line here cause ive
never done this before
Dim Thread1 As New System.Threading.Thread(AddressOf
fStatus.ShowDialog)
Thread1.Start()
'pbStatus is a status bar / progress bar
fStatus.pbStatus.Value += 10 'Increment Push Button
System.Threading.Thread.Sleep(2000) 'Will Call some sub instead later
fStatus.pbStatus.Value += 10
System.Threading.Thread.Sleep(2000) 'Will Call some sub instead later
fStatus.pbStatus.Value += 10
System.Threading.Thread.Sleep(2000) 'Will Call some sub instead later
'Somewhere here change the icon to be pointer again.
'close the form
fStatus.Close()
'im assuming i have to close the thread too or something?
fStatus.Dispose()
'user should have access to the whole app again.
'==== end of some command button _click event