Results 1 to 6 of 6

Thread: MDI Child Forms [Resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    116

    Resolved MDI Child Forms [Resolved]

    Hi,

    Is there a way to move a form before it becomes visible when it is an MDI child?

    I've tried setting the visible property to false at design-time, then using code to centre and show the form, but the form flashes for a second in its initial position before moving, which doesn't look great.

    Any ideas?
    Last edited by olamm2k; Mar 3rd, 2005 at 08:23 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: MDI Child Forms

    Are you positioning the child form in the MDI form load or child form load?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    116

    Re: MDI Child Forms

    Well, the first form is loaded like this:
    VB Code:
    1. Private Sub MDIForm_Load()
    2.     frmTemplate.Left = (Me.ScaleWidth - frmTemplate.Width) / 2
    3.     frmTemplate.Top = (Me.ScaleHeight - frmTemplate.Height) / 2
    4.     frmTemplate.Show
    5. End Sub

    And the subsequent forms are loaded like this:
    VB Code:
    1. Private Sub cmdMembers_Click()
    2.     frmDispMem.Left = Me.Left
    3.     frmDispMem.Top = Me.Top
    4.     Unload Me
    5.     frmDispMem.Show
    6. End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    116

    Re: MDI Child Forms

    I've just been experimenting some more...

    It seems like the form becomes visible whenever it is loaded, even though the visible property is set to false. I tried a button calling only frmDispMem.Hide, and it still flashed for a second before disappearing.

    I don't really seem to be making any head-way at the moment.

  5. #5

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    116

    Re: MDI Child Forms

    Thanks - it works okay as it is, actually. I worked out what I was doing wrong:

    In the form's Load event, I had included a Me.Show line because I was drawing a line on the form using code. This meant that when I tried to set any property or call a method of that form, the Load event fired and showed it.

    Oops!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width