G
Guest
Hello.
Im programming a Windows Forms application that has many user controls (e.g.
charts). These user controls have System.Threading.TimerCallback functions.
These functions Invoke other member methods that update the user controls
e.g.:
private void OnTimerUpdate(object pState)
{
if( mMainChart.InvokeRequired )
{
Invoke(new UpdateAndCleanUpChartDelegate(UpdateAndCleanUpChart));
}
else
{
UpdateAndCleanUpChart();
}
}
After calling Application.Exit() I get a bunch of message boxes with the
following messages:
System.ObjectDisposedException: Cannot access a disposed object named
"ParkingWindow".
Object name: "ParkingWindow".
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate
method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at System.Windows.Forms.Control.Invoke(Delegate method)
at MyChartClass.OnTimerUpdate(Object pState)An unhandled exception of
type 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "ParkingWindow".
This happens randomly, i.e. for different user controls each time.
Could anyone help me out here, how do I prevent this or handle the problem.
Regards,
Im programming a Windows Forms application that has many user controls (e.g.
charts). These user controls have System.Threading.TimerCallback functions.
These functions Invoke other member methods that update the user controls
e.g.:
private void OnTimerUpdate(object pState)
{
if( mMainChart.InvokeRequired )
{
Invoke(new UpdateAndCleanUpChartDelegate(UpdateAndCleanUpChart));
}
else
{
UpdateAndCleanUpChart();
}
}
After calling Application.Exit() I get a bunch of message boxes with the
following messages:
System.ObjectDisposedException: Cannot access a disposed object named
"ParkingWindow".
Object name: "ParkingWindow".
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate
method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at System.Windows.Forms.Control.Invoke(Delegate method)
at MyChartClass.OnTimerUpdate(Object pState)An unhandled exception of
type 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "ParkingWindow".
This happens randomly, i.e. for different user controls each time.
Could anyone help me out here, how do I prevent this or handle the problem.
Regards,