Hide Progress Bar

G

Guest

I have a form that changes images using the timer event and an IF statement.
When the timer times out the new image imports into the form. That works fine
but I see the progress bar as the image loads. Is there a way to stop the
progress bar from displaying?

Private Sub Form_Timer()
If (Me.imgMainMenu.Picture = "Image1") Then
Me.imgMainMenu.Picture = "Image2"
Exit Sub
End If
If (Me.imgMainMenu.Picture = "Image2") Then
Me.imgMainMenu.Picture = "Image3"
Exit Sub
End If
If (Me.imgMainMenu.Picture = "Image3") Then
Me.imgMainMenu.Picture = "Image1"
Exit Sub
End If
End Sub
 
D

Dirk Goldgar

rowiga said:
I have a form that changes images using the timer event and an IF
statement. When the timer times out the new image imports into the
form. That works fine but I see the progress bar as the image loads.
Is there a way to stop the progress bar from displaying?

Private Sub Form_Timer()
If (Me.imgMainMenu.Picture = "Image1") Then
Me.imgMainMenu.Picture = "Image2"
Exit Sub
End If
If (Me.imgMainMenu.Picture = "Image2") Then
Me.imgMainMenu.Picture = "Image3"
Exit Sub
End If
If (Me.imgMainMenu.Picture = "Image3") Then
Me.imgMainMenu.Picture = "Image1"
Exit Sub
End If
End Sub

Is it the "Loading Image..." progress dialog that you're talking about?
If so, there's a registry setting you can change to turn it off, or you
can use Timer code to spot and hide the dialog as soon as it appears.
See this link:

http://www.mvps.org/access/api/api0038.htm

If it's some other progress bar you're talking about, this probably
wouldn't apply.
 
G

Guest

Just a follow up question.

Out of curiousity, is it possible to have two separate timed actions on a
form? For example, have the picture change every 5 seconds, and have a
running clock updated every second?

No rush!

Thanks,
Todd
 
D

Dirk Goldgar

TT said:
Just a follow up question.

Out of curiousity, is it possible to have two separate timed actions
on a form? For example, have the picture change every 5 seconds, and
have a running clock updated every second?

Sure. The trick is to set the TimerInterval to an interval that can be
divided evenly into each of the two intervals you care about. Often
that's just the smaller of the two; for example, this time you could
set the TimerInterval to 1000 milliseconds (i.e., one second).

Then in the Timer event procedure you have a static counter that counts
the number of times the event has fired, and reset it each time you get
to the count that equates to the larger interval. For example;

'----- start of example code -----
Private Sub Form_Timer()

Static iTick As Integer

Call DoThisEverySecond()

iTick = iTick + 1

If iTick >= 5 Then
iTick = 0
Call DoThisEveryFiveSeconds()
End If

End Sub
'----- end of example code -----
 
G

Guest

Thank you very much!!

Very helpful!

Dirk Goldgar said:
Sure. The trick is to set the TimerInterval to an interval that can be
divided evenly into each of the two intervals you care about. Often
that's just the smaller of the two; for example, this time you could
set the TimerInterval to 1000 milliseconds (i.e., one second).

Then in the Timer event procedure you have a static counter that counts
the number of times the event has fired, and reset it each time you get
to the count that equates to the larger interval. For example;

'----- start of example code -----
Private Sub Form_Timer()

Static iTick As Integer

Call DoThisEverySecond()

iTick = iTick + 1

If iTick >= 5 Then
iTick = 0
Call DoThisEveryFiveSeconds()
End If

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top