Senin, 31 Oktober 2011

[MS_AccessPros] Re: How to cause a label to blink

 

Hi David,

Running this kind of code in the Form_Load will cause you and your application a lot of headaches. As John recommends, put the blink code in the timer Event and let it do both jobs. You will want to set the timer to 250 (a quarter of a second.) Off the top of my head:

Dim iCounter As Integer

Private Sub Form_Load()

Me.TimerInterval = 250
iCounter = 0
'more code as necessary

End Sub

Private Sub Form_Timer()

'More code as necessary

iCounter = iCounter + 1
Select Case iCounter Mod 4
Case 3
If Me.lblBlinker.Visible then Me.lblBlinker.Visible = False
Case Else
If not Me.lblBlinker.Visible then Me.lblBlinker.Visible = True
End Select

If iCounter > 8 Then
Me.TimerInterval = 0
DoCmd.Close acForm, Me.Name
End If

End Sub

The reason for the “if …visible” and “if not …visible” is that otherwise the Label can end up flashing ever so slightly every quarter of a second.

You might also like to set the label font to bold/non-bold or red/black rather than setting visible/invisible.

--- In MS_Access_Professionals@yahoogroups.com, "djsdaddy531" <drtolson@...> wrote:
>
> Great Day, I have a splashscreen that loads and remains visible for 4 seconds based on the On Timer event. I would also like to display a blinking label that says "Please wait while application is loading." Since I already have the On Timer event being triggered by the splashscreen, I tried to write some code to cause the label to blink. In the forms On Load event, I have the following code:
>
> Dim stloop1 As Long
> Dim stloop2 As Long
> Dim stloop3 As Long
>
> Do Until stloop1 = 10
> stloop1 = stloop1 + 1
> stloop2 = 1
> stloop3 = 1
> Me.lblWait.Visible = True
> Do Until stloop2 > 750
> stloop2 = stloop2 + 1
> Loop
> Me.lblWait.Visible = False
> Do Until stloop3 > 250
> stloop3 = stloop3 + 1
> Loop
> Loop
>
> I am trying to make the label visible for 3/4 of a second and invisible for 1/4 of a second; however the label does not show up at all. I would like to know how to make the label blink.
>
> Thanks in advance for your assistance.
>
> r/David
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar