I am trying to make a form flash colours whilst some other activity takes place, and then stop. I use the following functions to flash the form.
VB Code:
Private Function RunWalkthrough_0_1() 'Explain the display Call FlashForm(frmControlHead) 'Do stuff.... lalala Call StopFlashControl End Function Public Sub FlashForm(frmForm As Form, Optional ColourFlash = -1) On Error Resume Next 'Flash form between two colours every second flgFlashControl = True 'Set flash colour and original colour Dim OriginalColour As Long, FlashColour As Long FlashColour = IIf((ColourFlash < 0), DEFAULT_FLASH_COLOUR, ColourFlash) OriginalColour = frmForm.BackColor 'Flash form Do While (flgFlashControl) DoEvents 'Swap colours If frmForm.BackColor = FlashColour Then frmForm.BackColor = OriginalColour Else frmForm.BackColor = FlashColour End If 'Wait PauseMe (50000) Loop 'Return form colour frmForm.BackColor = OriginalColour End Sub Public Sub StopFlashControl() 'Reset flashing flag flgFlashControl = False End Sub 'Pause system in a loop temporarily Public Sub PauseMe(lngPauseDuration As Long) Dim i As Long Do Until i = lngPauseDuration i = i + 1 DoEvents Loop End Sub
But the code never seems to leave the FlashForm function. StopFlashControl is never callled. Bit of help, please?




Reply With Quote