Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1878
Exception when closing form
posted

Hi there,

I've a problem that costs me hours without finding any solution. I've a CAB-Application, containing a UserControl with several controls on it. I've a UltraComboEditor to show countries whereas the country names are fetched from the database into business objects and I'm using databinding to show those names in the Combo. Furthermore I'm using databinding to store the id (value) for the selected country into another business object. That all works perfectly fine so when I select a country with the combo the appropriate id for that country is stored in the business object.

My problem is when selecting a country but closing the entire application afterwards I get following exception:

System.ArgumentException: Cannot bind to the property or column CountryId on the DataSource.

When I set the focus onto another control after selection country in the combo and before closing the application there is no exception.

Any hints would be appriciated. Find the entire exception below:

System.ArgumentException: Cannot bind to the property or column CountryId on the DataSource.
Parameter name: dataMember
   at System.Windows.Forms.BindToObject.CheckBinding()
   at System.Windows.Forms.BindToObject.SetBindingManagerBase(BindingManagerBase lManager)
   at System.Windows.Forms.Binding.SetListManager(BindingManagerBase bindingManagerBase)
   at System.Windows.Forms.ListManagerBindingsCollection.AddCore(Binding dataBinding)
   at System.Windows.Forms.BindingsCollection.Add(Binding binding)
   at System.Windows.Forms.BindingContext.UpdateBinding(BindingContext newBindingContext, Binding binding)
   at System.Windows.Forms.Control.UpdateBindings()
   at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
   at Infragistics.Win.UltraWinEditors.UltraComboEditor.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.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.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.get_Handle()
   at System.Windows.Forms.Control.PointToClientInternal(Point p)
   at System.Windows.Forms.Control.PointToClient(Point p)
   at Infragistics.Win.UltraWinEditors.StyleUtils.IsHottracking(Control ctrl)
   at Infragistics.Win.UltraWinEditors.TextEditorControlBase.ResolveAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps, Boolean includeNullTextAppearance)
   at Infragistics.Win.UltraWinEditors.TextEditorControlBase.ResolveAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps)
   at Infragistics.Win.UltraWinEditors.EditorWithComboOwner.ResolveAppearance(Object ownerContext, AppearanceData& appearance, AppearancePropFlags& requestedProps, EmbeddableEditorArea area, Boolean hotTracking, String customArea)
   at Infragistics.Win.EditorWithTextAndDropDownUIElementBase.InitAppearance(AppearanceData& appearance, AppearancePropFlags& requestedPropFlags)
   at Infragistics.Win.EmbeddableUIElementBase.InitAppearanceInternal(AppearanceData& appearance, AppearancePropFlags& requestedProps)
   at Infragistics.Win.EmbeddableTextBox.ApplyAppearance()
   at Infragistics.Win.EditorWithCombo.Infragistics.Win.IValueListOwner.OnSelectedItemChanged()
   at Infragistics.Win.ValueList.ProcessSelectedIndexChanged(Int32 selectedIndex, Boolean commit)
   at Infragistics.Win.ValueList.set_SelectedIndex(Int32 value)
   at Infragistics.Win.BindableValueList.SetDataSource(Object value, Boolean notify)
   at Infragistics.Win.BindableValueList.SetDataBinding(Object dataSource, String dataMember)
   at Infragistics.Win.BindableValueList.OnDataSourceDisposed(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.ComponentModel.Component.Dispose(Boolean disposing)
   at System.Windows.Forms.BindingSource.Dispose(Boolean disposing)
   at System.ComponentModel.Component.Dispose()
   at System.ComponentModel.Container.Dispose(Boolean disposing)
   at System.ComponentModel.Container.Dispose()
   at Altova.OrderManagement.Common.OrderUserControl.Dispose(Boolean disposing) in C:\projects\ACS\Products\OrderManagement\Common\OrderUserControl.Designer.cs:line 18
   at Altova.OrderManagement.DraftOrders.DraftOrders.Dispose(Boolean disposing) in C:\projects\ACS\Products\OrderManagement\DraftOrders\DraftOrders.Designer.cs:line 20
   at System.ComponentModel.Component.Dispose()
   at System.Windows.Forms.Control.Dispose(Boolean disposing)
   at Microsoft.Practices.CompositeUI.WinForms.DeckWorkspace.Dispose(Boolean disposing)
   at System.ComponentModel.Component.Dispose()
   at System.Windows.Forms.Control.Dispose(Boolean disposing)
   at System.ComponentModel.Component.Dispose()
   at System.Windows.Forms.Control.Dispose(Boolean disposing)
   at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
   at System.ComponentModel.Component.Dispose()
   at System.Windows.Forms.Control.Dispose(Boolean disposing)
   at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
   at System.Windows.Forms.Form.Dispose(Boolean disposing)
   at Altova.Acs.ShellForm.Dispose(Boolean disposing) in C:\projects\ACS\Products\ACS\ShellForm.designer.cs:line 20
   at System.ComponentModel.Component.Dispose()
   at System.Windows.Forms.Form.WmClose(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   at System.Windows.Forms.Form.DefWndProc(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.WmSysCommand(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   at System.Windows.Forms.Form.DefWndProc(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.WmNcButtonDown(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Infragistics.Practices.CompositeUI.WinForms.IGFormShellApplication`2.Start() in C:\projects\ACS\Externals\Infragistics\NetAdvantage 2010.1\Windows Forms\CAB Extensibility Kit\Source\Infragistics.CompositeUI.WinForms\Application\IGFormShellApplication.cs:line 24
   at Microsoft.Practices.CompositeUI.CabApplication`1.Run()
   at Altova.Acs.ShellApplication.Main() in C:\projects\ACS\Products\ACS\ShellApplication.cs:line 39

Parents
  • 469350
    Offline posted

    What version of the controls are you using? Do you have the latest service release?

    It's hard to tell from just a call stack, but it looks like your BindingSource is getting disposed and this is triggering the UltraComboEditor to try to repaint itself which is causing it to try to access the data source, which was already disposed.

    If that's the case, then you might be able to work around this for now by changing the order of things and making sure that the UltraComboEditor is disposed (in the OnDispose of the form) before the BindingSource.

Reply Children