473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

timer

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
7 1325
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
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
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
"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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
7
by: Grahmmer | last post by:
I have a few timers that are added to a form at runtime. I can handle the event fine, but I cannot identify which timer fired. Is there a way to do this? Timer Creation: -------------...
2
by: John David Thornton | last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and I've coded it as shown below. However, when I install the service and then start it in MMC, I get a peculiar message: ...
12
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
8
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have...
8
by: =?Utf-8?B?RGF2ZSBCb29rZXI=?= | last post by:
I have a Timer that I set to go off once a day, but it frequently fails! In order to debug I would like to be able to check, at any moment, whether the Timer is enabled and when it will next...
11
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.