Hi
I have the following code
Public Class frmDataLogger
Dim WithEvents tmrDateTime As New System.Timers.Timer
Private Sub frmDataLogger_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tmrDateTime.Interval = 1000
tmrDateTime.Enabled = True
AddHandler tmrDateTime.Elapsed, AddressOf Me.UpdateDateTime
End Sub
Private Sub UpdateDateTime()
lblDate.Text = DateTime.Now.ToString("dd/MM/yyyy")
lblTime.Text = DateTime.Now.ToString("HH:mm:ss")
End Sub
When the UpdateDateTime is calle i get a cross thread operation not valid.
Hope you can help
Thanks
I have the following code
Public Class frmDataLogger
Dim WithEvents tmrDateTime As New System.Timers.Timer
Private Sub frmDataLogger_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tmrDateTime.Interval = 1000
tmrDateTime.Enabled = True
AddHandler tmrDateTime.Elapsed, AddressOf Me.UpdateDateTime
End Sub
Private Sub UpdateDateTime()
lblDate.Text = DateTime.Now.ToString("dd/MM/yyyy")
lblTime.Text = DateTime.Now.ToString("HH:mm:ss")
End Sub
When the UpdateDateTime is calle i get a cross thread operation not valid.
Hope you can help
Thanks