[Solved] Sharing one MenuStrip between multiple Forms and “open, save, save as” each form separately


Ok no problem

I’ve a Main form and call multiple panel (PanelSlider) with 1 MenuStrip with UserControl :

        public Form1()
    {
       InitializeComponent();
        PanelSlider.Controls.Add(new Home());
        PanelSlider.Controls.Add(new Tools());
        etc...
    }

Active Panel with button

    private void HomeBtn_Click(object sender, EventArgs e)
    {
        PanelSlider.Controls.Find("Home", false)[0].BringToFront();

    }

So to switch the multiple panel I declared a menustrip and for example:

    private void CallToolStripMenuItem_Click(object sender, EventArgs e)
    {
        PanelSlider_Utils.Controls.Find("Tools", false)[0].BringToFront();
    }

The problem was for 1 menustrip to open/save/save as option

The solution:

public void SaveToolStripMenuItem_Click(object sender, EventArgs e)
{
    Tools obj = this.Controls.Find("TOOLS", true)[0] as Tools;
    if (Tools != null)
        Tools.new_method();
}

and call new_method like this in TOOLS Form:

public void new_method()
{
 ...my code...
}

solved Sharing one MenuStrip between multiple Forms and “open, save, save as” each form separately