I have written a program (C#) which loads a form. On the primary screen it displays different text when I click OK. But the problem is... I am working with dual monitor, so when I load a form on the primary screen and drag it to secondary screen and click OK, it automatically moves back to the primary screen.
I have written a method which determines which screen the form is currently loaded on, which is working fine. However, when I tried to relocate it to the secondary screen, it no longer works (it's still moving back to the primary screen). I'm not sure what I'm doing wrong.
Here is my code:
if(Currentscreen == "primary")
{
forma.showDialog(this);//this is ok showing form on main screen
}
else
{
int showOnMonitor = 1;
Screen[] scr;
scr = Screen.AllScreens;
forma.StartPosition = FormStartPosition.CenterParent;
forma.Location = new Point(sc[showOnMonitor].Bounds.Left, sc[showOnMonitor].Bounds.Top); //this line should relocate it on secondary screen
forma.showDialog(this); //but its again loading on Primary monitor
}