H
Horst Klein
Mit dem Framework 2.0 habe ich ein Problem das ich vorher nicht hatte.
Oder es zumindest nicht festgestellt habe.
In my Application I show each seconnd the Time in a statusbar.
At runtim it works fine. If I want debug, fires an
"InvalidOperationException".
Is it my bug or a bug in VS2005 Beta2?
Here the code to reproduce it
Imports System.Globalization
Public Class Form1
Private m_DateTimer As New System.Timers.Timer
Private m_DateThread As Threading.Thread
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
m_DateThread = New Threading.Thread(AddressOf UpdateTime)
m_DateThread.Priority = Threading.ThreadPriority.Lowest
m_DateThread.Start()
End Sub
Private Sub RefreshDate(ByVal source As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Me.Text = DateTime.Today.GetDateTimeFormats("d"c,
CultureInfo.CurrentUICulture)(0).ToString
End Sub
Private Sub UpdateTime()
AddHandler m_DateTimer.Elapsed, AddressOf RefreshDate
m_DateTimer.Interval = 1000
m_DateTimer.Enabled = True
End Sub
End Class
Oder es zumindest nicht festgestellt habe.
In my Application I show each seconnd the Time in a statusbar.
At runtim it works fine. If I want debug, fires an
"InvalidOperationException".
Is it my bug or a bug in VS2005 Beta2?
Here the code to reproduce it
Imports System.Globalization
Public Class Form1
Private m_DateTimer As New System.Timers.Timer
Private m_DateThread As Threading.Thread
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
m_DateThread = New Threading.Thread(AddressOf UpdateTime)
m_DateThread.Priority = Threading.ThreadPriority.Lowest
m_DateThread.Start()
End Sub
Private Sub RefreshDate(ByVal source As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Me.Text = DateTime.Today.GetDateTimeFormats("d"c,
CultureInfo.CurrentUICulture)(0).ToString
End Sub
Private Sub UpdateTime()
AddHandler m_DateTimer.Elapsed, AddressOf RefreshDate
m_DateTimer.Interval = 1000
m_DateTimer.Enabled = True
End Sub
End Class