Click here to Skip to main content
15,920,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys, I would like you to help me with this problem, I have a program that has two forms, Form1 and Form2.
However, I really want to display (Form1 on Screen1), and (Form2 on Screen2).

Although, I find this app on the net and try it. it is not working could you help me with that.

What I have tried:

protected override void OnLoad(EventArgs e)

            if (Screen.AllScreens.Length > 1)

                Form2 frm = new Form2();

                // Important !
                frm.StartPosition = FormStartPosition.Manual;

                // Get the second monitor screen
                Screen screen = GetSecondaryScreen();

                // set the location to the top left of the second screen
                frm.Location = screen.WorkingArea.Location;

                // set it fullscreen
                frm.Size = new Size(screen.WorkingArea.Width, screen.WorkingArea.Height);

                // Show the form


public Screen GetSecondaryScreen()
            if (Screen.AllScreens.Length == 1)
                return null;

            foreach (Screen screen in Screen.AllScreens)
                if (screen.Primary == false)
                    return screen;

            return null;
Updated 4-Jul-22 20:19pm

1 solution

And? If I try it locally, it works fine for me.

The main form appears where I expected it to, and the second form appears on my second monitor.

Be aware though, that your code is prone to failure: if only one monitor is present, it will fail with a null reference exception. If you deliberately return a null value from a method, you need to check it before using it!

Are you getting confused because your "main display" is not set to the monitor you think it is? I have three monitors, and my main display is the center one, then 2 it to it's left, and three is to it's right. The numbering shown in the System.Display properties of the Settings app, is organised by connection to your graphics card, not by "monitor number".
Share this answer
Karam Ibrahim 5-Jul-22 11:47am    
Dear QriginalGriff,
If so, what can I do to solve that? Could you give me the solution?
I appreciate that.
OriginalGriff 5-Jul-22 12:05pm    
How can I "give you a solution" to a problem you haven't described, and I can't see or duplicate with the little info you have given us?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900