#Status Message Box in VB
4 messages in this thread
Status Box I have a form in which I use a Label with a fixed-single
BorderStyle as a status msg box. What I need to be able to do for a given
event is to change the contents of this label (ForeColor & Caption) and
change the mouse pointer to an hourglass. I then want to pause for 2
seconds and then restore the msg box and mouse pointer back to the normal
mode. What I am getting with the following code is the mouse pointer
changes for the correct interval, however the Label contents are unchanged.
Dim fTime As Double
fTime# = Now + .00002
Do
Form1.Label1.ForeColor = &HFF&
Form1.Label1.Caption = "ERROR"
Screen.MousePointer = 11
Loop Until (fTime# < Now)
Form1.Label1.ForeColor = &HFF00&
Form1.Label1.Caption = "ON-LINE"
Screen.MousePointer = 0
Any help would be greatly appreciated….Thanks
There are 2 Replies.
James,
Two things will probably fix things:
1. Insert an x% = DoEvents() before the Loop… line.
2. Insert a Form1.Label1.Refresh before the final Screen.MousePointer =
0
line (the last line).
The DoEvents() will allow Windows (and VB) to update the Caption, and also
allow Windows to do other things while you're pausing. The .Refresh will
cause VB to display the new caption.
– Ted
There is 1 Reply.
Thanks, Ted…..it works fine now and it's an essential element to my
application now. Looking forward to hearing from you (tips) in the
future.
– James
James,
What happens if you move the caption and color changes to before the loop
starts?
–dennis