ToolStripManager.LoadSettings - unexpected ArgumentNULLException

G

Guest

ToolStripManager.LoadSettings - unexpected exception ArgumentNULLException


USING:
Visual Studio 2005, .net-Framework 2.0, C# (same effect with VB)

PROBLEM:
ToolStripManager.LoadSettings(this) throws an ArgumentNULLException
exception. Input parameter 'this' is a valid Windows.Form, not NULL.

DETAILS:
'this' is a MDI container form. It has one ToolStripPanel with one
ToolStrip. This ToolStrip has one ToolStripButton.
One MDI child form is open inside the container form. The child form has its
own ToolStripPanel with one ToolStrip with one ToolStripButton.
At runtime the user moves the child form ToolStrip form the child form
ToolStripPanel into the parent form ToolStripPanel.
After that the application calls ToolStripManager.SaveSettings and after
that ToolStripManager.LoadSettings. This call throws an ArgumentNULLException.

QUESTIONS:
1) Am I doing something wrong?
If this is a bug:
2) When will it be fixed?
3) Is there any workaround?

(The possibility of saving/loading layout was one main reason for our
decision on using the new MS menu calsses instead of third-party components.)

STEPS TO REPRODUCE:
(Designer used, as far as possible)
- new C# Windows Application
- set IsMdiContainer to true for Form1
- add ToolStripPanel to the Toolbox (if not yet done)
- add ToolStripPanel to Form1
- add ToolStrip to the ToolStripPanel in Form1
- generate new ToolStripButton on this ToolStrip
- doubleclick on this new button and implement the event handler:
private void toolStripButton1_Click(object sender, EventArgs e)
{
ToolStripManager.SaveSettings(this);
ToolStripManager.LoadSettings(this);
}
- switch back to designer, doubleclick on Form1 and implement form load
event handler
private void Form1_Load(object sender, EventArgs e)
{
Form2 f = new Form2();
f.MdiParent = this;
f.Show();
}
- add a new windows form to the project (Form2)
- add ToolStripPanel to Form2
- add ToolStrip to the ToolStripPanel in Form2
- generate new ToolStripButton on this ToolStrip
- start the application
- move the child ToolStrip into the parent form ToolStripPanel (using mouse
and menu grip)
- click the button of the parent form ToolStrip
- ArgumentNULLException

Suggestion/hints/solutions highly appreciated.
Thanks for reading this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top