How would I be able to make a child form come to front on a button click?

How would I be able to make a child form come to front on a button click?


private void button1_Click(object sender, EventArgs e)
            Form2 s = new Form2();
            s.MdiParent = this;

        private void Form1_Load(object sender, EventArgs e)
            this.MdiChildActivate += new EventHandler(Form1_MdiChildActivate);

        void Form1_MdiChildActivate(object sender, EventArgs e)
            bool b = MdiChildren.Any((p) =>

                    return p.Visible;

            if (!b)

I dont need the button to disappear, since when I made my form MDIParent it turned my form backcolor to a unpleasent color, so I put a picture box with the color I want as the backcolor, and the childforms dont come up in front of the picturebox.

A summary of what I need to do, bring a child form in front of a picture box.

Ok, I made my own code,but I include me changing my start up form(Form1()) to Form1(Form8 F). As a conclusion to that, it made a error in my program.cs

The error

Error	1	'iUltimate.Form1' does not contain a constructor that takes '0' arguments	C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\iUltimate\iUltimate\Program.cs	18	29	iUltimate

Any suggestions?

Pass "null" as an argument.

Edit Program.cs:

Application.Run([B]new Form1(null)[/B]);

And before assigning the "F" variable, check if its not a null:

if (F != null)
  form8 = F;


Edited 6 Years Ago by farooqaaa: n/a

Say I had another form that needs to retrieve data from form1, how would I do that?

This article has been dead for over six months. Start a new discussion instead.