Solved

Dialog box does not position correctly using FormStartPosition

Posted on 2006-11-09
2
580 Views
Last Modified: 2012-06-21
I cannot get my dialog box to display anywhere other than the top left corner.  I've seen posts where people claim that they have gotten this to work.  Any ideas???

HERE'S THE CODE...
RequestValidateForm frmValidate = new  RequestValidateForm();
frmValidate.requestValidateCtl1.oValidateResult = oValidateResult;
                              
frmValidate.StartPosition = FormStartPosition.CenterParent;
                              
DialogResult oResult =  frmValidate.ShowDialog(this);

I'VE ALSO TRIED...
frmValidate.StartPosition = FormStartPosition.Manual;
frmValidate.Location = new Point(SystemInformation.WorkingArea.Width / 2 - frmValidate.Size.Width / 2, SystemInformation.WorkingArea.Height - frmValidate.Size.Height);

AND THIS...
frmValidate.StartPosition = FormStartPosition.Manual;
frmValidate.Top = 150;
frmValidate.Left = 150;
0
Comment
Question by:thespiceman
2 Comments
 
LVL 3

Accepted Solution

by:
troywillmot earned 500 total points
ID: 17911399
That code seems to work fine for me. Is it possible there is code in your RequestValidateForm form class that is repositioning the form or preventing the location from being set (a property/method override or some code setting top/left/location etc) ?

Which version of VS/C# are you using ?
0
 

Author Comment

by:thespiceman
ID: 17916522
I checked and there were no overrides.  What I DID find was that the form was set to Maximized, i.e. WindowState=Maximized.  It is working now :)  Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now