supercharge
Registered User.
- Local time
- Today, 00:26
- Joined
- Jun 10, 2005
- Messages
- 215
Hi all,
Does anyone have any idea why a function does not get called before a loop such as a for loop eventhough the Call is placed ahead of the loop?
Example: Function ShowWait is placed before the For loop but when you run the example (attached), the calculation takes about 1 second but during that time, the status box's backcolor and text should be changed according to the function below. Right now, it happens only after the completion of the loop.
Thanks all in advance.
Does anyone have any idea why a function does not get called before a loop such as a for loop eventhough the Call is placed ahead of the loop?
Example: Function ShowWait is placed before the For loop but when you run the example (attached), the calculation takes about 1 second but during that time, the status box's backcolor and text should be changed according to the function below. Right now, it happens only after the completion of the loop.
Code:
Private Sub cmdCal_Click()
UpdateConfirm = MsgBox("Are you sure you want to do this? Click Yes to confirm!", vbYesNo)
If UpdateConfirm = vbYes Then
'ShowWait Function not being called 'till after the for loop????????
ShowWait
''''''''
For w = 1 To 1000 Step 0.025
A = 1000 / w
txtResult.Value = A
Next w
Else
Exit Sub
End If
WorkDoneAlert = MsgBox("Operation Completed!")
HideWait
End Sub
Function ShowWait()
txtStatus.BackColor = RGB(255, 0, 255)
txtStatus.Value = "Updating..."
End Function
Function HideWait()
txtStatus.BackColor = RGB(0, 128, 64)
End Function