PDA

View Full Version : Procedure stops running after UserForm.Show



WillyTheFish
10-16-2008, 03:29 PM
Hey guys,

i have a little issue here. I tried to goggle it, but i don't know what to search for :S

I just make it short: I was trying to call UserForm2.Show on a second userform.
When it appears the active procedures in UserForm1 seem to stop, until I manually close the UserForm2 :S
I don't get it, is it not possible to run two forms simultaneously?

Thanks in advance!!

Bob Phillips
10-16-2008, 03:33 PM
Yes it is. Show us the code to move it further.

WillyTheFish
10-16-2008, 03:40 PM
Hmm okay.. lets see...

Private Sub lblMainMenuItem5_Click()
Call gDataImportFromFile
Call gProgress(25, 0, 100, "%")
Call gCreateTemporaryDbTable
End Sub


Public Sub gProgress(ByVal bytValue As Byte, bytMin As Byte, bytMax As Byte, strCaption As String)

If bytCompleted > bytMax Then
Unload frmProgress
Else
'Wait
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

frmProgress.ProgressBar.Min = bytMin
frmProgress.ProgressBar.Max = bytMax
frmProgress.ProgressBar.Value = bytValue

frmProgress.Caption = bytValue & strCaption
frmProgress.Show
End If
End Sub

The function 'gCreateTemporaryDbTable' never gets executed
until i close the 'frmProgress'-form manually! :(

Thanks again!

WillyTheFish
10-17-2008, 02:32 AM
anyone? Please?

Bob Phillips
10-17-2008, 02:41 AM
It is difficult to get the whole picture, I cannot see where the progress lop is or anything, how it would get terminated.

WillyTheFish
10-17-2008, 07:21 AM
Thanks for staying with me xld =)

Yeah I know, it's kinda hard to explain 'the big picture' in this case.
Well, I try it this way:

I've got a form, (frmMain) where a lable-button is placed (lblMainMenuItem5).
When clicking it, several procedures will start, one to import an textfile, one to convert one currency into another, one to store information inside a database and so on....

Since all these procedures take alot of time, and there's no indication on that the application is working, I wanted to add a small primitive progress-bar, that pops up in a new form (frmProgress).

By passing values with By Val i want to increase the value of the progressbar. This works fine aswell, if it were not for the application to stop all it's procedures when displaying the frmProgress with
frmProgress.Show

I have to close the frmProgress Form manually to make the application continue working :S

I hope I made it more clear now?! =)

Big thanks again!

magicalstone
11-12-2008, 04:53 AM
Set ShowModal to False on Userform properties.