• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

C# Form Issues

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Midnight Dream

OSPF Loving Member
Joined
Mar 17, 2004
Location
Lawrenceville, Georgia
Ok, so here is the deal. I have my form, which runs a _Load event. In that event, I have it load another form I have created. I want this form to be positioned to the right of the first form, so I issue the commands like such

Code:
        private void loginDialog_Load(object sender, EventArgs e)
        {
            Form loginDialogNetworks = new loginDialogNetworks();
            loginDialogNetworks.Location = new Point((this.Location.X)+100, 0;
            loginDialogNetworks.Show();
        }

However, the second form (loginDialogNetworks) doesnt move any. Help?

Edit: Fixed it. Needed to swap the last 2 lines of code.
 
Last edited:
The Location will be changed when you call Show unless you change the StartPosition property.

Code:
        private void loginDialog_Load(object sender, EventArgs e)
        {
            Form loginDialogNetworks = new loginDialogNetworks();
            loginDialogNetworks.Location = new Point((this.Location.X)+100, 0;
            loginDialogNetworks.StartPosition = FormStartPosition.Manual;
            loginDialogNetworks.Show();
        }

This will prevent any noticable dialog repositioning.
 
Back