Positioning of Child Forms on MDI Form

Posted on 2005-03-26
Medium Priority
Last Modified: 2010-05-02
I have a standard MDI Form with 5 or 6 different Child Forms.  The problem is that the program does not recognize when child forms are closed.  For example, I open two forms...and then close them.  When I open the third form, it opens where a third form would be...rather than where the first opened form would be.  Does anyone have a routine or an easy way to fix this?  Thanks.
Question by:tsicks
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
  • 2
  • 2
LVL 19

Accepted Solution

Shauli earned 400 total points
ID: 13637298
You can cascade the forms, so if more than one form is shown, they will be cascaded, and if only one is shown, it will be displayed in the upper left position. To do that, simply add the cascade command after your form.show, as in:

MDIForm1.Arrange vbCascade


Author Comment

ID: 13637335
That does work, but I see a visible jump.  Is there anyway to minimize the jump?
LVL 19

Expert Comment

ID: 13637383
There is nothing much you can do about it, unless you want to lock the form:

LockWindowUpdate Me.hWnd  'lock
MDIForm1.Arrange vbCascade
LockWindowUpdate False   'unlock

For that to work you need to put the following code in a bas module:

Option Explicit
Public Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long


Author Comment

ID: 13637452
That takes care of the problem.  Thanks for the help.

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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