Dialog box does not position correctly using FormStartPosition

Posted on 2006-11-09
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???

RequestValidateForm frmValidate = new  RequestValidateForm();
frmValidate.requestValidateCtl1.oValidateResult = oValidateResult;
frmValidate.StartPosition = FormStartPosition.CenterParent;
DialogResult oResult =  frmValidate.ShowDialog(this);

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

frmValidate.StartPosition = FormStartPosition.Manual;
frmValidate.Top = 150;
frmValidate.Left = 150;
Question by:thespiceman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

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 ?

Author Comment

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!

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

627 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