Hi Benj Nunez

thank you for your help

Salim

On May 5, 1:02 pm, Benj Nunez <[email protected]> wrote:
> Here's how:
>
> To begin with, let's assume you already have Form1 which has the
> menustrip. Make sure
> the modifier of your menustrip is set to public. We will construct
> Form2 (the childform):
>
> 1) Create a Newform(the childform)
> 2) declare a Form1 variable in your childformlike:
>
>     private static new Form1 ParentForm = null;
>
> 3) define a second constructor, with Form1 as a parameter, like:
>
>         public Form2(Form1 AParent): this()
>         {
>             ParentForm = AParent;
>         }
>
> 4) drag a button in your childform.
> 5) double click your button and type this:
>
>         private void btnEnable_Click(object sender, EventArgs e)
>         {
>             ParentForm.menuStrip1.Enabled = !
> ParentForm.menuStrip1.Enabled;
>         }
>
> Now go back to your Form1 class to instantiate Form2. In this example,
> put
> a button in Form1. Double-click the button in Form1 and add this code:
>
>             Form2 form2 = new Form2(this);
>             form2.ShowDialog();
>
> Pass "this" to Form2. "this" refers to the Form1 instance. It allows
> you
> to access any controls in Form2. Provided that the controls in Form1
> have
> their modifiers set to public.
>
> Hope this helps.
>
> Benj
>
> On May 3, 9:31 pm, sahm <[email protected]> wrote:
>
> > Hi every one
> > How to can IenableordisableMenuStripin ParentFormfrom chiliad
> >form
> > Best
> > Salim

Reply via email to