PDA

Click to See Complete Forum and Search --> : Blinking label...


Mar 9th, 2001, 02:32 PM
Sub BlinkLbl(lbl As Label)
Do
Start = Timer

Do While Timer < Start + 0.25
DoEvents
Loop

lbl.Visible = Not lbl.Visible
Loop
End Sub

Private Sub Command1_Click()
BlinkLbl Label1
End Sub

oVeRRiDe
Mar 10th, 2001, 04:22 AM
Decepticon? What does that mean? More than a Guru?
;-)

Thanks, in fact this code works well!
Bye!

Mar 10th, 2001, 08:33 AM
Your Welcome. It's also possible to do this with the SetTimer API, but why use API when this function just the job just as good.

Yeah, you get to choose your own title when you pass 4k.

YoungBuck
Mar 10th, 2001, 12:41 PM
A couple of enhancements to your code, so that the Do Loop will stop and the form will be unloaded when the app is ended....



Sub BlinkLbl(lbl As Label)
Do Until DoEvents = 0
Start = Timer

Do While Timer < Start + 0.25
DoEvents
Loop

lbl.Visible = Not lbl.Visible
Loop
End Sub

Private Sub Command1_Click()
Call BlinkLbl(lbl)
Unload Me
End Sub

Mad Compie
Mar 11th, 2001, 04:56 AM
In DOS it was much easier to do this!
Sometimes it is also necessary to refresh the label after setting the Visible property of the Label control

Mar 11th, 2001, 09:45 AM
Refresh it? I don't think you'd need to do that after you change its Visible property.

Mad Compie
Mar 12th, 2001, 01:30 PM
Unfortunately Yes, Meg.
Often, when working with my applications I ask myself the question "Hey, where is my label control?".
When debugging the code and getting the Visible property of the control, it's should be really visible, but I don't see it. When using the Refresh method after setting the Visible property, everything works fine. strange, but that happens sometimes...

Mar 12th, 2001, 01:47 PM
I've worked with VB for over 5 years and I've never has this problem. Perhaps it's just a bug in VB6, because I've used VB3, 4 and 5, but never encountered this.

Mad Compie
Mar 12th, 2001, 01:54 PM
I encounter this in VB3. It also happens sometimes (not often as I said) when changing the Caption property.