Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Positioning a dialog in the center of the parent form

Posted on 2007-10-16
Medium Priority
Last Modified: 2013-12-17
Hi Experts,

In my .Net C# GUI application, I want to display a dialog box from my parent form.  I created a new For class and was able to display it using the code snippet below.  But, the dialog does not appear in the center of the parent form.  How can I position it in the center?  I tried using setDesktopLocation( ) but it is not what I want.

                StartStop ss = new StartStop();
Question by:ambuli
  • 2
LVL 14

Assisted Solution

by:Daniel Junges
Daniel Junges earned 200 total points
ID: 20088816
you have to assign the parent form, like:

StartStop ss = new StartStop();
ss.MdiPatent = this;
ss.StartPosition = FormStartPosition.CenterParent;
LVL 22

Accepted Solution

JimBrandley earned 600 total points
ID: 20088818
Try this:
ss.StartPosition = FormStartPosition.CenterParent;

then show the dialog.

LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 200 total points
ID: 20090867
junges....you can't use ShowDialog() with MdiChildren...

LVL 14

Expert Comment

by:Daniel Junges
ID: 20092384
you are right Idle_Mind, Ambuli have to use ss.Show()  instead ss.ShowDialog().

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

581 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