Home All Groups Group Topic Archive Search About
Author
8 Mar 2006 3:35 PM
Lamis
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

Author
8 Mar 2006 5:43 PM
Mike
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..
Author
8 Mar 2006 7:24 PM
cj
Might also try just displaying an animated gif of a blinking battery.


Lamis wrote:
Show quoteHide quote
> 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
Author
9 Mar 2006 7:34 AM
Lamis
Hi Mike,

No, start() is not helping..

How do I display an animated gif????
--
LZ


Show quoteHide quote
"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
>
Author
9 Mar 2006 1:18 PM
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:
Show quoteHide quote
> Hi Mike,
>
> No, start() is not helping..
>
> How do I display an animated gif????
Author
9 Mar 2006 9:30 AM
Armin Zingler
Show quote Hide quote
"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
Author
9 Mar 2006 11:25 AM
Lamis
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


Show quoteHide quote
"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
>
>
Author
9 Mar 2006 1:47 PM
Armin Zingler
"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