Why isn't form centering in parent?

B

Bruce

I have the StartPosition property set to CenterParent for
GarXfaceUI.TransferStatus.

The button below is on another form. Why isn't
GarXfaceUI.TransferStatus being centered in the parent?


Private Sub RxWaypoints_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles RxWaypoints.Click


Private frmTransfer As New GarXfaceUI.TransferStatus
frmTransfer.Show(Me)

End Sub
 
C

Cor Ligthert [MVP]

Bruce,
The button below is on another form. Why isn't GarXfaceUI.TransferStatus
being centered in the parent?

Because that you only call a method which does nothing.

Cor
 
H

Herfried K. Wagner [MVP]

Bruce said:
Private Sub RxWaypoints_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles RxWaypoints.Click


Private frmTransfer As New GarXfaceUI.TransferStatus
frmTransfer.Show(Me)

End Sub

Your code does not compile because 'Private' cannot be used inside a method.
 
B

Bruce

Herfried said:
Your code does not compile because 'Private' cannot be used inside a
method.




It is actually global

Private frmTransfer As New GarXfaceUI.TransferStatus

Private Sub RxWaypoints_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles RxWaypoints.Click



frmTransfer.Show(Me)

End Sub



I just pasted in in for ease of viewing the code. The code compiles and
runs the second dialog just does not center on the parent.

RxWaypoints_Click is a button on one form that shows a second form
(dialog box).
 
B

Bruce

Cor said:
Bruce,
The button below is on another form. Why isn't GarXfaceUI.TransferStatus
being centered in the parent?

Because that you only call a method which does nothing.

Cor

Bruce said:
I have the StartPosition property set to CenterParent for
GarXfaceUI.TransferStatus.

The button below is on another form. Why isn't GarXfaceUI.TransferStatus
being centered in the parent?


Private Sub RxWaypoints_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles RxWaypoints.Click


Private frmTransfer As New GarXfaceUI.TransferStatus
frmTransfer.Show(Me)

End Sub

It is actually global

Private frmTransfer As New GarXfaceUI.TransferStatus

Private Sub RxWaypoints_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles RxWaypoints.Click



frmTransfer.Show(Me)

End Sub



I just pasted in in for ease of viewing the code. The code compiles and
runs the second dialog just does not center on the parent.


--


Bruce E. Stemplewski
GarXface OCX and C++ Class Library for the Garmin GPS
www.stempsoft.com
 
S

Stephany Young

For some reason or another the CenterParent value for the Form.StartPosition
property is only honoured if a form is shown using the ShowDialog method.

When the show method is used and the StartPosition property is set to
CenterParent then the behaviour is the same as if was set to
WindowsDefaultLocation.

Passing a 'parent' to the method has no effect on this. The 'parent'
paramter is used where you want the form to be 'parented' to yet another
form.

Say you have a Form (form1) from which you have 'shown' a another Form
(form2). You also have another Form (form3) that you 'show' from form1 but
want it 'parented' to form2. To do this you execute the statement (in
form1):

form3.Show(form2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top