Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:49:11+00:00 2026-06-12T07:49:11+00:00

In .Net WinForms I have two forms. Form1 is open and active. How can

  • 0

In .Net WinForms I have two forms. Form1 is open and active. How can I open new form (Form2) that:

  • Form1 must have focus
  • Form2 is opened under Form1 (background Form1)

First point is simple see stackoverflow…
But I don’t know how to show Form2 under Form1.
Thanks.

EDIT

 public partial class Form1 : Form
{
    Form2 frm;

    public Form1()
    {
        InitializeComponent();
        frm = new Form2();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        textBox1.Focus();
        timer1.Start();
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        this.AddOwnedForm(frm);
        frm.Show();
        frm.SendToBack();
        this.BringToFront();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        frm.Show();
        frm.SendToBack();
        this.BringToFront();
    }

}

Form2

public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();            
    }

    private void Form2_Load(object sender, EventArgs e)
    {
        textBox1.Focus();
    }

    protected override bool ShowWithoutActivation
    {
        get
        {
            return true;
        }
    }

    protected override CreateParams CreateParams
    {
        get
        {
            //make sure Top Most property on form is set to false
            //otherwise this doesn't work
            int WS_EX_TOPMOST = 0x00000008;
            CreateParams cp = base.CreateParams;
            cp.ExStyle |= WS_EX_TOPMOST;
            return cp;
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:49:13+00:00Added an answer on June 12, 2026 at 7:49 am

    I think for second point what you need to do is this:

    var form2 = new Form2();
        form2.MdiParent = form1; //form1 is your parent form; use this operator in case you are creating this form from out base form
    
        form2.WindowState = FormWindowState.Normal;
        form2.Show();
    

    Please have a look at this for further details:

    http://msdn.microsoft.com/en-us/library/system.windows.forms.form.mdiparent.aspx

    EDIT

    Please see below code which gives an appearance that frm is open on top of Form1.

    public partial class Form1 : Form
    {
        Form2 frm;
    
        public Form1()
        {
            InitializeComponent();
            frm = new Form2();
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            textBox1.Focus();
            timer1.Start();
        }
    
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (!frm.Visible)
            {
              this.AddOwnedForm(frm);
              frm.Show();
              frm.SendToBack();
              this.BringToFront();
            }
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            this.AddOwnedForm(frm);
            frm.Show();
            frm.SendToBack();
            this.BringToFront();
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C# .net winforms application with two forms which connects to sql
I have a WinForms application (VS 2008, .NET 3.5) that has a form with
I have a .net WinForms 2.0 application that has an image library of about
I have a WinForms application written in C# for .NET 3.5 that needs to
I'm developing a .NET application that will have both a WinForms and a Silverlight
Hopefully I am wording/asking this right. I have a Winforms, .Net 3.5, app that
I have a C# .NET 2.0 WinForms app. My app has a control that
I have two .net 2 winforms, each has its own project. project 1 is
I have a WinForms Form (C#/.Net) and it contains a PictureBox, MenuStrip, Panel and
I have a c# .net winforms solution and I want to create two different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.