473,327 Members | 2,071 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,327 software developers and data experts.

MDI Child window position

Hi Guys,

I have a Parent form (Form1) and a child form (Form2). If I open the child
form with the following code:-

<code>
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem1.Click
Dim NewMDIChild As Form = New Form2
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
End Sub
End Class
</code>

All works well. If I close Form2 with Me.close() the form closes. OK so far.
If I then open Form2 again from the menubar, the window opens but is moved
to a new position in the parent window. How can I get Form2 to open in the
same position all the time?

Cheers

Peter.
Nov 21 '05 #1
1 1779
That is a regular behaviour of a child window. So, you'll need save the last
position of your window when closing and, when loading, set the Top and Left
properties.

[]s
Cesar
"Peter W Johnson" <vk****@yahoo.com> escreveu na mensagem
news:%2***************@TK2MSFTNGP15.phx.gbl...
Hi Guys,

I have a Parent form (Form1) and a child form (Form2). If I open the child
form with the following code:-

<code>
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem1.Click
Dim NewMDIChild As Form = New Form2
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
End Sub
End Class
</code>

All works well. If I close Form2 with Me.close() the form closes. OK so far.
If I then open Form2 again from the menubar, the window opens but is moved
to a new position in the parent window. How can I get Form2 to open in the
same position all the time?

Cheers

Peter.

Nov 21 '05 #2

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

Similar topics

20
by: Geoffrey H. Goldberg | last post by:
I have made a remote control window which opens from its parent. On loading, the remote is positioned relative to the screen using window.moveTo(x,y). What I would like to happen is the remote...
0
by: Pietje de kort | last post by:
Hi all, I've build a simple mdi application. It has 1 mdiparent, and 2 mdichild forms. The 1st child form is docked left, the second is docked fill. The code to create the child forms: form =...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: Henry Wu | last post by:
Hi,.. I have 2 forms with the same width & height, one with 100 opacity and the other with 50% opacity. Since I'm in an MDI application, the form with the 50% opacity cannot be a MDI Child or else...
1
by: Mitchell Vincent | last post by:
Strange thing is happening.. I have the StartPosition of my MDI child window set to CenterParent (at design time), yet when I close the window and re-open it the start position gets shifted down...
3
by: mabond | last post by:
Hi Why is my mdichild form not starting in the "centerparent" position? I'm using the following: Public Class frmCAD Private Sub MakeNewCallToolStripMenuItem_Click(ByVal sender As...
4
by: Jassim Rahma | last post by:
how can I maximize the MDI child in the free MDI parent area not in the whole window.. I mean in the (whole window area - menubar - tool bar) so i want the MDi child to show its whole window and...
6
by: =?Utf-8?B?QVRU?= | last post by:
Hi, My MDI (Parentform) form can have 2 two type of forms (Datagridform and graphicform). When users create a new form, they have to pick either child form. When those child forms are created...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.