|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
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 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.. 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 Hi Mike,
No, start() is not helping.. How do I display an animated gif???? -- Show quoteHide quoteLZ "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 > 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????
Show quote
Hide quote
"Lamis" <La***@discussions.microsoft.com> schrieb What does your application do while the battery is to be blinking? Does it > 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 do nothing (ie. waiting for your input) or is it doing anything? Armin 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. -- Show quoteHide quoteLZ "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 > > "Lamis" <La***@discussions.microsoft.com> schrieb I didn't know there are more threads. Rephrased question:> 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. 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
Adding button programatically - NON-FUNCTIONAL!!
Checking for new versions in a setup project Garbage collection and callbacks from unmanaged code. Exception Error When Calling Procedure Multiple Times Can a console VB.NET prog return a value to caller? Help with strings. Array.Sort Error on Graphics CompositingMode.SourceCopy Numeric Variables converting from combobox.text to long() |
|||||||||||||||||||||||