N
nic
I'm getting the following error fairly often (but randomly), and I can't
figure out why it is happening. Any ideas?
The line of my code that the error comes from is this:
//m_ConfigurationForm is a form that is member variable of the object
that the code is in
DialogResult result = m_ConfigurationForm.ShowDialog(Form.ActiveForm);
I get a popup box with the following:
An unhandled exception of type 'System.ObjectDisposedException' occurred
in system.windows.forms.dll
Additional information: Cannot access a disposed object named
"ParkingWindow".
And the following exception, with stack trace:
System.ArgumentException: Item has already been added. Key in dictionary:
"System.Windows.Forms.BindingContext+HashKey" Key being added:
"System.Windows.Forms.BindingContext+HashKey"
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean
add)
at System.Collections.Hashtable.Add(Object key, Object value)
at System.Windows.Forms.BindingContext.EnsureListManager(Object
dataSource, String dataMember)
at System.Windows.Forms.BindingContext.get_Item(Object dataSource, String
dataMember)
at System.Windows.Forms.ListControl.SetDataConnection(Object
newDataSource, BindingMemberInfo newDisplayMember, Boolean force)
at System.Windows.Forms.ListControl.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd,
Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
<Snip> My double click event handler etc. <Snip>
figure out why it is happening. Any ideas?
The line of my code that the error comes from is this:
//m_ConfigurationForm is a form that is member variable of the object
that the code is in
DialogResult result = m_ConfigurationForm.ShowDialog(Form.ActiveForm);
I get a popup box with the following:
An unhandled exception of type 'System.ObjectDisposedException' occurred
in system.windows.forms.dll
Additional information: Cannot access a disposed object named
"ParkingWindow".
And the following exception, with stack trace:
System.ArgumentException: Item has already been added. Key in dictionary:
"System.Windows.Forms.BindingContext+HashKey" Key being added:
"System.Windows.Forms.BindingContext+HashKey"
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean
add)
at System.Collections.Hashtable.Add(Object key, Object value)
at System.Windows.Forms.BindingContext.EnsureListManager(Object
dataSource, String dataMember)
at System.Windows.Forms.BindingContext.get_Item(Object dataSource, String
dataMember)
at System.Windows.Forms.ListControl.SetDataConnection(Object
newDataSource, BindingMemberInfo newDisplayMember, Boolean force)
at System.Windows.Forms.ListControl.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs
e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd,
Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
<Snip> My double click event handler etc. <Snip>