Results 1 to 14 of 14

Thread: [RESOLVED] [2005] form not opening right

  1. #1

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Resolved [RESOLVED] [2005] form not opening right

    I changed the MainMenuStrip property to menuStrip1 and since then, I've been having problems with the way forms open and close. On load, the form opens up half way instead of filling the whole screen. The window state is maximized but it continues to open half way. The first picture is how the form is opening and the second picture shows how the form is supposed to open.
    Name:  frmNotOpeningRight.JPG
Views: 361
Size:  29.6 KB
    Name:  rightWayForFormToOpen.JPG
Views: 357
Size:  23.8 KB

    Also, I keep getting an error message: Cannot access a disposed object.
    Object name: 'Icon'. when I try to close the forms.

    Can somebody please help!!!!????
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: [2005] form not opening right

    The form is maximizing.... the panel is not.... try making sure your panel is set to Dock = Fill... or anchor it to all sides (I'd go with dock=fill).
    As for the other error, with out knowing what code is running, can't help you. But it sounds like you're tryign to clear out an Icon for an object (presumably the form) after it's been disposed of.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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

    Re: [2005] form not opening right

    I assume you have tried rebuilding your solution and closing and reopening the form designer window?
    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

  4. #4

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] form not opening right

    I don't have a panel on the form.

    The code I am trying to run is
    vb Code:
    1. For Each frms As Form In Me.MdiChildren
    2.         frms.Close()
    3.   Next
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] form not opening right

    did you add this menustrip1 to the MDI parent or the MDI child form?

    as for your dispose error try this:

    Code:
    For Each frms As Form In Me.MdiChildren        
        if not frms.IsDisposed then
            frms.close
        end if
    Next

  6. #6

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] form not opening right

    It is on the MDI Parent and no menustrip is specified for the rest of the child forms.

    I will try your code, thanks!
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] form not opening right

    I don't really have a reason why it is happening, but it appears to be some sort of bug.

    How I was able to get it to work though, was to NOT set the child forms windowstate to maximized at design time (leave it as normal) but then when you actually create an instance and show the form, set it to maximized in code before showing it..

    IE in the MDI parent:
    Code:
            Dim F As New frmChild
            F.MdiParent = Me
            F.WindowState = FormWindowState.Maximized
            F.Show()

  8. #8

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] form not opening right

    ok, i will try that and see how it works for me. thanks a bunch!
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  9. #9

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] form not opening right

    Quote Originally Posted by kleinma
    did you add this menustrip1 to the MDI parent or the MDI child form?

    as for your dispose error try this:

    Code:
    For Each frms As Form In Me.MdiChildren        
        if not frms.IsDisposed then
            frms.close
        end if
    Next
    That didn't work, I still get the same error message.
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  10. #10

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] form not opening right

    Quote Originally Posted by kleinma
    I don't really have a reason why it is happening, but it appears to be some sort of bug.

    How I was able to get it to work though, was to NOT set the child forms windowstate to maximized at design time (leave it as normal) but then when you actually create an instance and show the form, set it to maximized in code before showing it..

    IE in the MDI parent:
    Code:
            Dim F As New frmChild
            F.MdiParent = Me
            F.WindowState = FormWindowState.Maximized
            F.Show()
    I did the exact same thing but the form just flickers multiple times and never opens.
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  11. #11
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: [2005] form not opening right

    This may sound stupid... but I'm going to ask anyways.... what's the border style for the form?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  12. #12

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] form not opening right

    It's sizable. I'm going to kick myself if this is what is causing the error!
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  13. #13

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] form not opening right

    I changed it to Fixed single and it is working fine now but for some reason, when I added the mainmenustrip to the mdi parent, i can't close the child forms. It gets stuck on this:

    [highlight = vb]
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing) 'gets stuck here when trying to close
    End Sub
    [/highlight]
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  14. #14
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: [2005] form not opening right

    Interesting... I would have expected that to be the other way around... at least that part is solved.

    As for the dispose problem.... don't know... .I don't normaly add the dispose code to my forms, so that's a little out of my element.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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