G
Graham McKechnie
Hi,
I've come across a problem while converting a project to 2005. I've been
struggling with this for the last couple of days and was wondering if anyone
can shed any light on the following exception.
System.ArgumentException was unhandled
Message="An error message cannot be displayed because an optional resource
assembly containing it cannot be found"
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Windows.Forms.Control._SetParent()
at System.Windows.Forms.Control.set_Parent()
at ControlCollection.Add()
at TTG.Forms.RoundWizardForm.InitializeWizardForms()
at TTG.Forms.RoundWizardForm..ctor()
at TTG.Forms.MainForm.menuItemNewRoundWizard_Click()
at System.Windows.Forms.MenuItem.OnClick()
at System.Windows.Forms.Menu.ProcessMnuProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at TTG.TTGMain.Main()
In 2003 I had a wizard setup that would allow a number of windows to be
displayed forward/back in sequence. It consisted of a holding window which
just contained a single panel and a toolbar. The forms of the wizard to be
displayed inside the panel were inherited from a single form. The base form
was a form with Border style set to none. It had a show method that set the
text property of the holding window to the caption property of each window.
These forms were part of a collection and as they were instantiated in the
holding window they were added to the collection with the following
public WizardForm Add(WizardForm wizardForm)
{
// get the location and size from the panel
Point location = hostPanel.Location;
Size size = hostPanel.Size;
// make the new page ( window ) the dimensions of the panel
wizardForm.Location = location;
wizardForm.Size = size;
// Add the new page to our list
this.List.Add(wizardForm);
// Add the page to the host panel's controls.
hostPanel.Controls.Add(wizardForm); // this is the line that
fails
return wizardForm;
}
In 2005 this is giving the above exception when executing
hostPanel.Controls.Add(wizardForm).
It would appear that Controls.Add has some additional checking in VS2005
that is causing this to fail, but I'm having a hard time trying to guess
what it doesn't like.
I also use this type of code in a custom tab control in another project,
where the panel is not full screen, so I guess it is also going to fail at
the same point.
I was hoping someone would have a workaround or suggestion, to overcome
this.
Graham
I've come across a problem while converting a project to 2005. I've been
struggling with this for the last couple of days and was wondering if anyone
can shed any light on the following exception.
System.ArgumentException was unhandled
Message="An error message cannot be displayed because an optional resource
assembly containing it cannot be found"
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Windows.Forms.Control._SetParent()
at System.Windows.Forms.Control.set_Parent()
at ControlCollection.Add()
at TTG.Forms.RoundWizardForm.InitializeWizardForms()
at TTG.Forms.RoundWizardForm..ctor()
at TTG.Forms.MainForm.menuItemNewRoundWizard_Click()
at System.Windows.Forms.MenuItem.OnClick()
at System.Windows.Forms.Menu.ProcessMnuProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at TTG.TTGMain.Main()
In 2003 I had a wizard setup that would allow a number of windows to be
displayed forward/back in sequence. It consisted of a holding window which
just contained a single panel and a toolbar. The forms of the wizard to be
displayed inside the panel were inherited from a single form. The base form
was a form with Border style set to none. It had a show method that set the
text property of the holding window to the caption property of each window.
These forms were part of a collection and as they were instantiated in the
holding window they were added to the collection with the following
public WizardForm Add(WizardForm wizardForm)
{
// get the location and size from the panel
Point location = hostPanel.Location;
Size size = hostPanel.Size;
// make the new page ( window ) the dimensions of the panel
wizardForm.Location = location;
wizardForm.Size = size;
// Add the new page to our list
this.List.Add(wizardForm);
// Add the page to the host panel's controls.
hostPanel.Controls.Add(wizardForm); // this is the line that
fails
return wizardForm;
}
In 2005 this is giving the above exception when executing
hostPanel.Controls.Add(wizardForm).
It would appear that Controls.Add has some additional checking in VS2005
that is causing this to fail, but I'm having a hard time trying to guess
what it doesn't like.
I also use this type of code in a custom tab control in another project,
where the panel is not full screen, so I guess it is also going to fail at
the same point.
I was hoping someone would have a workaround or suggestion, to overcome
this.
Graham