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
740
InvalidOperationException when closing the Window
posted

Hi there,

I have a child form which pop up from a MdiParent Form. In this Child form I have added some components including BindingSource, Ultra Labels, Ultra Textboxes,Ultra Combos, Ultra Validators etc. Also this form inhertis some features of Wizard from another base class which has functionalites for "Next" and "Previous" buttons. When I go to Finish tab and press the Finish button or if I close it from the close button in the window, it gives the following Error message:

InvalidOperationException : "Databinding cannot occur unless a BindingContext or BindingContextControl has been specified."

   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()

Position of coding which the error occur marked in red:

protected virtual void Dispose(bool disposing) {

if (disposing) {

lock(this) {

if (site != null && site.Container != null) {

site.Container.Remove(this);

}

if (events != null) {

EventHandler handler = (EventHandler)events[EventDisposed];

if (handler != null) handler(this, EventArgs.Empty);

}

}

}

}

 I would like to know whats the cause of this exception if anyone came across with the same issue.

Need help urgently!

Regards,

nw