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:
if (disposing) {
if (site != null && site.Container != null) {
}
EventHandler handler = (EventHandler)events[EventDisposed];
I would like to know whats the cause of this exception if anyone came across with the same issue.
Need help urgently!
Regards,
nw
Hi,
I'm not sure exactly what this code it. But it looks like it's the Dispose method of your form. Is that right?
If that's the case, then it appears that your form's Dispose method is firing events - which probably isn't a good idea. Did you add that code to the Dispose method? If so, why are you attempting to fire events when the form is being disposed?
If that code was added automatically, then I'm not sure where it came from, but it could be a bug.
Hi Mike,
Thanks for your reply.
protected virtual void Dispose(bool disposing) {
And my class has the following Dispose method.
{if (disposing && (components != null)) {components.Dispose();}
I think from the components.Dispose() method it goes to the Component class Dispose() method. I think when disposing, some events are not being released. And I just added the following code to dispose the components which has events. But when the bindingsource.dispose() method fires, it goes to that same exception.
{this.ultraLabel1.Dispose();this.ultraLabel2.Dispose(); this.txtText1.Dispose();this.uDateTimeEditor1.Dispose();this.ultraValidator1.Dispose();
How can I solve this exception? Help please!!
If that's the line of code it's blowing up on, then it appears to be a bug. Somewhere in your application, you have a ValueList bound to the genderBindingSource, and the ValueList is responding to the dispose event and blowing up in there.
If you are not already using the latest Hot Fix, I recommend getting it and seeing if that helps. If it does not help, you should Submit an incident to Infragistics Developer Support and include a small sample project demonstrating the errror so they can get it corrected.
Thanks for your response Mike. I recreated the form since its urgent, then no problem. Wonder from where did it come from !! Thanks again.
NW