Re: Timer Label Visibility Question
- From: "Jim Carlock" <anonymous@localhost>
- Date: Mon, 15 May 2006 19:25:49 -0400
"AK" <nospam@xxxxxxxxxxx> wrote:
If I comment it out, I have to set the default design visibility
property of lblTime in the form to False, cause I do not want
the label (showing the time) to become visible until I click the
LogIn button. (The time display is used to show the clock
time while other parts of the code are executing the log in
functions of the program and thereby let the user kow that
things are happenig behind the scenes.
Private Sub cmdLogIn_Click()
lblTime.Visible = True
Debug.Print Test 'Checkpoint print
'etc more code
End Sub
Can't tell what you really want by looking at the code you
presented, so I'm going along with what you've posted in
the message.
Private Sub cmdLogIn_Click()
Timer1.Enabled = True
' blah blah blah
End Sub
Private Sub Timer1_Timer()
Static i As Long
i = i + 1
lblTimer.Caption = CStr(i)
If i = 10 Then
'stop counting
Timer1.Enabled = False
'Just set the Caption to an empty string and it disappears
'(unless you have a border around it).
lblTimer.Caption = ""
'reset counter
i = 0
'do whatever else you need to do
'...
End If
'DoEvents
End Sub
If I could find it, I would use a progress bar but I need one
that bounces back and forth to show time passage and a
clock was a quick way to show some action.)
You can also use a progress bar to display a bar that disappears
or a bar that reaches the end. Click on Project, then Components,
then scroll down to Microsoft Common Controls 5.0 or Microsoft
Common Controls 6.0. Both of those have a progressbar. They
both have a statusbar as well. Not sure if one is better than the
other. Once you put a checkmark into one of them, close the
Components dialog and drag the progressbar onto the form. The
statusbar might be an option as well. You could use a Timer to
turn a wheel in the status bar or in the label.
Private miCountDown As Long
Private Property Let CountDown(ByVal i As Long)
'reset miCountDown
miCountDown = i
'login operation timed out, handle other things
End Property
Private Sub Timer1_Timer()
Static i As Long
If i = 0 Then
lblTimer.Caption = " | "
i = i + 1
'miCountDown is a form scoped long variable
miCountDown = iCountDown - 1
ElseIf i = 1 Then
lblTimer.Caption = " / "
i = i + 1
ElseIf i = 2 Then
lblTimer.Caption = "---"
i = i + 1
ElseIf i = 3 Then
lblTimer.Caption = " \ "
i = 0
End If
If miCountDown <= 0 Then
Timer.Enabled = False
Me.CountDown = 0 'reset countdown, handle other things
End If
End Sub
Perhaps I'm missing something. All I have to work with at the
moment involves:
There's a Timer on the form which adjusts a count.
There's a label on the form that presents the count (based upon
code inside the Timer).
A LogIn button turns the visibility of the label on or off.
Does the Timer run all the time? What's the purpose of Timer1?
Is the only purpose for that label to show the countdown?
Something else that might work for you is a statusbar. You can
create a few panels on the status bar. You mentioned time but
talked about a timer. Those could be two different concepts
entirely. For instance, place a StatusBar onto the form, and create
a panel to display the time. That time is different than a countdown
timer. :-)
Hope that helps.
Jim Carlock
Post replies to the group.
--
Raleigh Swimming Pool Builders http://www.aquaticcreationsnc.com/
.
- Follow-Ups:
- Re: Timer Label Visibility Question
- From: AK
- Re: Timer Label Visibility Question
- References:
- Timer Label Visibility Question
- From: AK
- Re: Timer Label Visibility Question
- From: Jim Carlock
- Re: Timer Label Visibility Question
- From: AK
- Timer Label Visibility Question
- Prev by Date: Re: Copy and Zero memory
- Next by Date: Re: ActiveX Control, Displaying modeless form -- Error 401
- Previous by thread: Re: Timer Label Visibility Question
- Next by thread: Re: Timer Label Visibility Question
- Index(es):
Relevant Pages
|