I ran into a problem and found out what was causing the problem, but I
believe it is a bug in .NET.
I have a main Form and I was adding and removing my own derived UserControls
to create a Wizard-looking application. The Main Form was equivalent to a
"PropertySh eet" in MFC and the UserControl is equivalent to the
"PropertyPa ge".
Everything was working fine until I learned another trick with "data
binding" one control's property to another control's property. So, I added
this to make a control visible whenever a checkbox was checked:
myControl.DataB indings.Add("Vi sible", myCheckBox, "Checked");
This worked great!
But, that killed my Wizard navigation. When I tried to remove my
UserControl that contained a databinding from the Form using
"Controls.Remov e(currentPage)" it threw a Stack Overflow Exception from the
CLR with the following message "An unhandled exception of type
'System.StackOv erflowException ' occurred in system.windows. forms.dll".
If I now clear all the data bindings from the UserControl before I remove it
from the Form, it works fine.
Eric
believe it is a bug in .NET.
I have a main Form and I was adding and removing my own derived UserControls
to create a Wizard-looking application. The Main Form was equivalent to a
"PropertySh eet" in MFC and the UserControl is equivalent to the
"PropertyPa ge".
Everything was working fine until I learned another trick with "data
binding" one control's property to another control's property. So, I added
this to make a control visible whenever a checkbox was checked:
myControl.DataB indings.Add("Vi sible", myCheckBox, "Checked");
This worked great!
But, that killed my Wizard navigation. When I tried to remove my
UserControl that contained a databinding from the Form using
"Controls.Remov e(currentPage)" it threw a Stack Overflow Exception from the
CLR with the following message "An unhandled exception of type
'System.StackOv erflowException ' occurred in system.windows. forms.dll".
If I now clear all the data bindings from the UserControl before I remove it
from the Form, it works fine.
Eric