PDA

View Full Version : [SOLVED] picture not load after time sometimes



petroj02
10-19-2016, 12:04 AM
Hello all,
I have 30 Pictures saved on Server and I want to Switch These 30 Pictures after one second at Frame.picture after click on command button. so far so good but Problem is that sometimes my program get stuck and dont load next Picture. And I dont know where is a Problem Could someone help me? there is my code

module


Function waitTime(ByVal miliSeconds As Double)
Application.Wait (Now() + miliSeconds / 24 / 60 / 60 / 1000)
End Function

click Event


Private Sub CommandButton1_Click()

For j = 1 To 30
waitTime (1000)
Frame1.Picture = LoadPicture("V:\CGC_DATA\Images\picture" & j & ".jpg")
Next
End Sub

mana
10-19-2016, 12:37 AM
frame1.repaint

petroj02
10-19-2016, 03:09 AM
Bingo! Thank you so much

Paul_Hossler
10-19-2016, 07:32 AM
If you just want to pause things for a bit, I like to use Sleep



'Api declaration for suspending operation for a specified time
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)




Sleep 2000 ' for 2000 ms or 2 seconds