Hello, im writing a vb program that is a graphical user interface for a robot. When the robot starts up it sends a command to PC telling the gui to start a timer showing how long the robot has been running. The only problem is that the timer never enables, It goes through the decision statement and says it should execute, but never does ( i put break points in after the hthe line of code where I enable the timer, and it says the timer should be enabled, I also put a set of break points in the timer ISR, but those are never tripped).
Basicaly what my problem boils down to is there anyway to set off a timer from an external input.
Thanks for your help
~Steve

Controlling a Timer with an External Input
jo123
has the timers interval ever been set:
Me
.Timer1.Interval = 1000Jean-Michel Herve
For more info, check out http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=174589&SiteID=1
Best regards,
Johan Stenberg
Rohan Reddy
JimShort
Orest
you can call from your form method named BeginInvoke(). In it's params you provide delegate to your another method, let say StartTimer. StartTimer will set Enabled to true. Also it's good to set Text property in UI thread too, it's not thread safe to set it in background thread.
Albert Yen -MS
Hi!
There is 3 Timer classes in .NET... which one you use
Can you post code that you use to start timer
In general you need to use System.Windows.Forms.Timer component, set Enabled property to true of false when external event happens and in timer handler you must increase elapsed seconds by 1 (timer resolution is 1000 ms).
Leena S
Marais_Kruger
Here is my "Proof of Concept" code, just to see if i can get it to work.
Imports
System.IO.PortsPublic
Class Form1 Dim seconds As Integer Private WithEvents objPort As SerialPort Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadCheckForIllegalCrossThreadCalls =
FalseobjPort =
New SerialPort("COM4", 9600)objPort.ReceivedBytesThreshold = 2
objPort.Open()
End Sub Private Sub objPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles objPort.DataReceived Dim temp As String Dim strSerialPortData As String = objPort.ReadExistingtemp = strSerialPortData
TextBox2.Text = temp
If strSerialPortData = "AA" ThenTimer1.Enabled =
True End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tickseconds = seconds + 1
TextBox1.Text = seconds
TextBox3.Text = 1
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickobjPort.Close()
Me.Close() End SubEnd
ClassBasically all i want it to do is to start a timer when i get a certain input from a micro controller. But for some strange reason when i debug the program the timer says it should be enabled but it never executes the timer1_Tick routine.
sqldbapree