473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

StartPosition=CenterParent doesn't seem to work


I have configured a few of the windows I am working on to have the
form value "Start Position" to be "CenterParent" but some of them
don't.

Does Center Parent only work when the dialog is modal? I'm not writing
an MDI application so I other posts I've read just don't seem very
relevent.

Do I have to explicitly set the parent??? What if I don't know it is?

Anyone?

Thanks in advance, Phill

Jun 21 '07 #1
2 13509
Interesting, I just tried it using .Show and it didn't center then
..ShowDialog and it did. Both times FormStartPosition.CenterParent
"Phillip Ross Taylor" <Ph*****************@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
>
I have configured a few of the windows I am working on to have the
form value "Start Position" to be "CenterParent" but some of them
don't.

Does Center Parent only work when the dialog is modal? I'm not writing
an MDI application so I other posts I've read just don't seem very
relevent.

Do I have to explicitly set the parent??? What if I don't know it is?

Anyone?

Thanks in advance, Phill

Jun 21 '07 #2
"Phillip Ross Taylor" <Ph*****************@gmail.comschrieb im Newsbeitrag
news:11*********************@q75g2000hsh.googlegro ups.com...
>
I have configured a few of the windows I am working on to have the
form value "Start Position" to be "CenterParent" but some of them
don't.

Does Center Parent only work when the dialog is modal? I'm not writing
an MDI application so I other posts I've read just don't seem very
relevent.

Do I have to explicitly set the parent??? What if I don't know it is?
Hm. The following code works fine for me:

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click

Dim f As New Form()
f.Owner = Me
f.StartPosition = FormStartPosition.CenterScreen
f.ShowInTaskbar = False
f.Show()

End Sub

With parent you mean owner, I guess. The MSDN help says about the Owner
property of a form:

"When a form is owned by another form, it is minimized and closed with the
owner form. For example, if Form2 is owned by form Form1, if Form1 is closed
or minimized, Form2 is also closed or minimized. Owned forms are also never
displayed behind their owner form. You can use owned forms for windows such
as find and replace windows, which should not disappear when the owner form
is selected. To determine the forms that are owned by a parent form, use the
OwnedForms property."

Robert

--
e-mail: r_.s_chnei_der\wein_gart_ner.com (remove all '_' and replace '\'
with
'@')

Jun 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: C-Sharper or C-Hasher, one of the two | last post by:
Hi Guys and Gals, I have a small, two form, application. Form1 is the main window and Form2 is a small window that has a label and a progress bar on it. I wish to display form2 whilst doing some...
6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
15
by: Peter B.L. Rasmussen | last post by:
I want to start an app, and at the same time control where it is placed. I use the following code, but it doesn't seem to work. The MoveWindow call doesn't move the window. What am I doing wrong?...
4
by: Duncan | last post by:
Hi I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#, I'm just starting with a few simple examples and I've come across a problem. I've got two forms ones an MDI parent &...
3
by: sklett | last post by:
I thought this would be easy. I want to position a login form based on whether or not it has a parent form, so I tried this: <code> if (ParentForm == null) { StartPosition =...
3
by: smellican | last post by:
Is there an easy way to set the starting position of a common dialog such as savefiledialog, printdialog, fontdialog, etc.? There doesn't seem to be a StartPosition property for common dialogs.
4
by: > Adrian | last post by:
I have "CenterParent" in the Properties and in the form location in the application, and still the form that is called does not get positionned center parent. Parent = this; produces errors. How do...
2
by: _dee | last post by:
Not a critical problem, just annoying: Normally I use : this.StartPosition = FormStartPosition.CenterParent; in the constructor of a dialog to make sure it doesn't show up in the corner of the...
2
by: Eric B. | last post by:
1) Where the heck are the icons stored in VS? I know there are not a lot, but I used the "Insert Standard Items" command on the menubar and lo and behold, icons! 2) How do set a child/parent...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.