Setting a location of screen on a dual screen monitor

Hi,
Trying to set a working area for a dual screen .
The form opens on Screen2 rather than Screen1.
Any suggestion on how to open on the same screen as the MainForm

FrmMain : is the Main form
Code:
  With Frm2
                       
                        .StartPosition = FormStartPosition.Manual
                        workingArea = Screen.GetWorkingArea([b]FrmMain[/b])
                        .Location = New Point(workingArea.Right - Size.Width,
                          workingArea.Bottom - Size.Height)
                        .ShowDialog()                      
                    End With

Open in new window


Thanks
RIASAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

Have you seen this class?
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.screen.allscreens?redirectedfrom=MSDN&view=netframework-4.7.2#System_Windows_Forms_Screen_AllScreens

Also, please go ahead and try this-

Form2.Location = Me.Location

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Also this should work-

Form2.Location = FrmMain.Location

Open in new window

AndyAinscowFreelance programmer / ConsultantCommented:
Does this work (replace your current code)
Frm2.StartPosition = FormStartPosition.CenterParent
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

RIASAuthor Commented:
Thanks Andy! Will try
AndyAinscowFreelance programmer / ConsultantCommented:
ps.  To find out what happens with your current code you ought to use a breakpoint and single step to CHECK just what you get as values of the main forms location and what you are putting as values for the location of Frm2
RIASAuthor Commented:
Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.