C
Colin Young
I have a form that I dynamically instantiate user controls on. I also
dynamically remove use controls. Frequently the application just won't end
when I click the close button on the main form. The Close event is being
called and I am making sure that I set the focus to a control that is not
being removed before I remove any user controls. I thought that had fixed
the problem, but it has reappeared..
Any suggestions? I've attached the relevant code to the end of this message.
Thanks.
Colin
private void LoadPlugin(IGBPlugIn plugIn)
{
ModuleToolBar.Focus();
MainControlPanel.Controls.Clear();
ModuleActionsPanel.Controls.Clear();
plugIn.MainControl.Dock = DockStyle.Fill;
MainControlPanel.Controls.Add(plugIn.MainControl);
foreach (object o in plugIn.PanelControls)
{
XPanderControl.XPander panel = new XPanderControl.XPander();
panel.DockPadding.Left = 4;
panel.DockPadding.Right = 4;
panel.DockPadding.Bottom = 4;
((PanelControl)o).Control.Dock = DockStyle.Fill;
panel.Controls.Add(((PanelControl)o).Control);
panel.CaptionText = ((PanelControl)o).Caption;
ModuleActionsPanel.Controls.Add(panel);
}
}
private void GBWPipelineOfferMenu_Click(object sender, System.EventArgs e)
{
IGBPlugIn GBWOffers = new
GordonBrothers.GBW.DealsheetManager.Controls.OfferSheetControl();
LoadPlugin(GBWOffers);
}
private void GBWPipelineDealsheetMenu_Click(object sender, System.EventArgs
e)
{
IGBPlugIn GBWDeals = new
GordonBrothers.GBW.DealsheetManager.Controls.DealSheetControl();
LoadPlugin(GBWDeals);
}
dynamically remove use controls. Frequently the application just won't end
when I click the close button on the main form. The Close event is being
called and I am making sure that I set the focus to a control that is not
being removed before I remove any user controls. I thought that had fixed
the problem, but it has reappeared..
Any suggestions? I've attached the relevant code to the end of this message.
Thanks.
Colin
private void LoadPlugin(IGBPlugIn plugIn)
{
ModuleToolBar.Focus();
MainControlPanel.Controls.Clear();
ModuleActionsPanel.Controls.Clear();
plugIn.MainControl.Dock = DockStyle.Fill;
MainControlPanel.Controls.Add(plugIn.MainControl);
foreach (object o in plugIn.PanelControls)
{
XPanderControl.XPander panel = new XPanderControl.XPander();
panel.DockPadding.Left = 4;
panel.DockPadding.Right = 4;
panel.DockPadding.Bottom = 4;
((PanelControl)o).Control.Dock = DockStyle.Fill;
panel.Controls.Add(((PanelControl)o).Control);
panel.CaptionText = ((PanelControl)o).Caption;
ModuleActionsPanel.Controls.Add(panel);
}
}
private void GBWPipelineOfferMenu_Click(object sender, System.EventArgs e)
{
IGBPlugIn GBWOffers = new
GordonBrothers.GBW.DealsheetManager.Controls.OfferSheetControl();
LoadPlugin(GBWOffers);
}
private void GBWPipelineDealsheetMenu_Click(object sender, System.EventArgs
e)
{
IGBPlugIn GBWDeals = new
GordonBrothers.GBW.DealsheetManager.Controls.DealSheetControl();
LoadPlugin(GBWDeals);
}