PDA

View Full Version : Solved: Sleep - Problem



pcsparky
10-17-2010, 02:20 AM
I have followed the advice on the Article pages to 'Create a Delay' using:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

at the top of a module with this code:

Sub DelayTest()
Menu.lblSaved.Visible = True
Sleep 1000& 'delay in milliseconds
Menu.lblSaved.Visible = False
End Sub

I'm trying to get a label with caption "Saved" to show for a short time on clicking a Save button on my form. However, when I call 'DelayTest' nothing happens apart from the time delay.
If I run through the code step by step the label does show, the time delay does work, and then the label does disappear again.

I'm baffled if anyone can shed light please.

p45cal
10-17-2010, 04:34 AM
try the repaint method

pcsparky
10-17-2010, 09:06 AM
I've never even heard of the Repaint method. But hey presto it works like a dream. Don't know what the problem was before but this certainly fixes it.

Thanks p45cal