Problem with a timer

G

Guest

I have a Winform running and a timer (winform) firing each 3 min to make a
transmition of data..I'm ok about the UI stoping for a while, the problems is
that the timer fires two times in every interval, even if I use time.Stop.

It seems that the stop instruction is not stoping the timer associated counter

Private Sub TimerTransmite_Tick(....)
TimerTrans.Stop()
Transfer()
TimerTrans.Start()
End


Any Sug?
 
T

TCORDON

If the timer has the interval you want why would you want to stop and start
it every time?

As for the UI stoping, have you considered running Transfer() on a different
thread? You could have Trasnfer() Start the timer when it finishes and you
UI would not stop.

Regards,
 
G

Guest

hi

well, I'm stoping the timer because in the transfer procedure I'm sending
critical information (money) as a long string to a WebService (sincronous) so
I dont want to the timer overlaps the previous Tick event if the webservice
take to long to return.

To be honest, I was playing aroung with Asinc WS and the result was my Data
being duplicated when I sent it to the server, so I'm a little bit frustated
with Async ws
 
H

Herfried K. Wagner [MVP]

Kenny M. said:
I have a Winform running and a timer (winform) firing each 3 min to make a
transmition of data..I'm ok about the UI stoping for a while, the problems
is
that the timer fires two times in every interval, even if I use time.Stop.

What type of timer are you using? Are you sure you are using a
'System.Windows.Forms.Timer'?
 
G

Guest

yeap I'm Sure it is a Windows.forms.Timer that I Drag from the toolbox

it is pretty simple to see what I said. just set an interval (60000) and set
a breakpoint on transfer and you will see that after the breakpoint stop and
press F5 inmediatly the Breakpoint is fired again

Private Sub TimerTrans_Tick(....)
TimerTrans.Stop()
Transfer()
TimerTrans.Start()
End

thks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top