By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,682 Members | 1,090 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,682 IT Pros & Developers. It's quick & easy.

timer

P: n/a
HI,

I need to have a blinking battery in my application. I thought timer is the
best way to make that...
My problem is that my timer is disabled when my application starts and when
timBattBlink_Tick never executes eventhoug I changed enabled = true...
Any ideas why this is happining??

Private Sub shutDown(ByVal instState As String)
If instState = "wait for shutdown" Then
Me.picBattery.Visible = True
timBattBlink.Interval = 500
timBattBlink.Enabled = True
Else
Me.picBattery.Visible = False
timBattBlink.Enabled = False
End If

End Sub

Public Sub timBattBlink_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles timBattBlink.Tick
If Me.picBattery.Visible = True Then
Me.picBattery.Visible = False
Else
Me.picBattery.Visible = True
End If
End Sub
--
LZ
Mar 8 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hai,

You need to start the timer if you want the timer to tick.

So apart from enabling the timBattBlink.enabled = True, have

timBattBlink.start()

Try to even refresh the picture just in case.

Me.picBattery.refresh()

Hope it helps..

Mar 8 '06 #2

P: n/a
cj
Might also try just displaying an animated gif of a blinking battery.
Lamis wrote:
HI,

I need to have a blinking battery in my application. I thought timer is the
best way to make that...
My problem is that my timer is disabled when my application starts and when
timBattBlink_Tick never executes eventhoug I changed enabled = true...
Any ideas why this is happining??

Private Sub shutDown(ByVal instState As String)
If instState = "wait for shutdown" Then
Me.picBattery.Visible = True
timBattBlink.Interval = 500
timBattBlink.Enabled = True
Else
Me.picBattery.Visible = False
timBattBlink.Enabled = False
End If

End Sub

Public Sub timBattBlink_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles timBattBlink.Tick
If Me.picBattery.Visible = True Then
Me.picBattery.Visible = False
Else
Me.picBattery.Visible = True
End If
End Sub

Mar 8 '06 #3

P: n/a
Hi Mike,

No, start() is not helping..

How do I display an animated gif????
--
LZ
"cj" wrote:
Might also try just displaying an animated gif of a blinking battery.
Lamis wrote:
HI,

I need to have a blinking battery in my application. I thought timer is the
best way to make that...
My problem is that my timer is disabled when my application starts and when
timBattBlink_Tick never executes eventhoug I changed enabled = true...
Any ideas why this is happining??

Private Sub shutDown(ByVal instState As String)
If instState = "wait for shutdown" Then
Me.picBattery.Visible = True
timBattBlink.Interval = 500
timBattBlink.Enabled = True
Else
Me.picBattery.Visible = False
timBattBlink.Enabled = False
End If

End Sub

Public Sub timBattBlink_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles timBattBlink.Tick
If Me.picBattery.Visible = True Then
Me.picBattery.Visible = False
Else
Me.picBattery.Visible = True
End If
End Sub

Mar 9 '06 #4

P: n/a
"Lamis" <La***@discussions.microsoft.com> schrieb
HI,

I need to have a blinking battery in my application. I thought timer
is the best way to make that...
My problem is that my timer is disabled when my application starts
and when timBattBlink_Tick never executes eventhoug I changed
enabled = true... Any ideas why this is happining??

Private Sub shutDown(ByVal instState As String)
If instState = "wait for shutdown" Then
Me.picBattery.Visible = True
timBattBlink.Interval = 500
timBattBlink.Enabled = True
Else
Me.picBattery.Visible = False
timBattBlink.Enabled = False
End If

End Sub

Public Sub timBattBlink_Tick(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles timBattBlink.Tick
If Me.picBattery.Visible = True Then
Me.picBattery.Visible = False
Else
Me.picBattery.Visible = True
End If
End Sub
--
LZ

What does your application do while the battery is to be blinking? Does it
do nothing (ie. waiting for your input) or is it doing anything?
Armin

Mar 9 '06 #5

P: n/a
Hi,
My application is doing alot of other things, I have 4 other timers going on
and alot of threads..
this timer works very well if it's enabled from the start. When I disable
it, it never works again.
--
LZ
"Armin Zingler" wrote:
"Lamis" <La***@discussions.microsoft.com> schrieb
HI,

I need to have a blinking battery in my application. I thought timer
is the best way to make that...
My problem is that my timer is disabled when my application starts
and when timBattBlink_Tick never executes eventhoug I changed
enabled = true... Any ideas why this is happining??

Private Sub shutDown(ByVal instState As String)
If instState = "wait for shutdown" Then
Me.picBattery.Visible = True
timBattBlink.Interval = 500
timBattBlink.Enabled = True
Else
Me.picBattery.Visible = False
timBattBlink.Enabled = False
End If

End Sub

Public Sub timBattBlink_Tick(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles timBattBlink.Tick
If Me.picBattery.Visible = True Then
Me.picBattery.Visible = False
Else
Me.picBattery.Visible = True
End If
End Sub
--
LZ

What does your application do while the battery is to be blinking? Does it
do nothing (ie. waiting for your input) or is it doing anything?
Armin

Mar 9 '06 #6

P: n/a
cj
You can display an animated gif just like any picture inside a picture
box. You'll either have to find an animated gif of a battery on the
internet or make one yourself. I have never created one myself I know
there is software that will let you. Search Google for animated gif and
you'll find lots of animated gifs to test. Using an animated gif will
not require any fancy coding to allow your program to continue working
while the "battery blinks".

Lamis wrote:
Hi Mike,

No, start() is not helping..

How do I display an animated gif????

Mar 9 '06 #7

P: n/a
"Lamis" <La***@discussions.microsoft.com> schrieb
Hi,
My application is doing alot of other things, I have 4 other timers
going on and alot of threads..
this timer works very well if it's enabled from the start. When I
disable it, it never works again.

I didn't know there are more threads. Rephrased question:
What does your thread that started the timer do while the battery is to be
blinking? Does it do nothing (ie. waiting for your input) or does it doing
anything? I asked because if you start a long running task in the same
thread after enabling the timer, this would explain that the Timer doesn't
fire anymore. Did you also check that the code is executed at all? BTW, I
wouldn't compare against a string.
Armin

Mar 9 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.