Call Timer_Tick and Reset Timer

lip

Active Member
Licensed User
Longtime User
I am using a timer to send messages from a queue via bluetooth. The next message is only sent when either a reply has been received for the last message or it has timed out (2 seconds). The CommandTimer_Tick sub processes the last response and sends the next command.

To speed things up I call the _Tick sub as soons as a response is received via Bluetooth. I then need the timer to wait (up to) a further 2 seconds for the next response.

I call the _Tick sub as follows to ensure that the timer is reset to 2 seconds:-

CommandTimer.Enabled = False
CommandTimer_Tick
CommandTimer.Enabled = True

Is there a more elegant way to do this? ie is there a specific command that restarts the timer? Perhaps I could put somthing like this into the _Tick sub

CommandTimer.Interval = CommandTimer.Interval
 
Top