Results 1 to 2 of 2

Thread: [2005] Me.Close vs. Me.Dispose

  1. #1

    Thread Starter
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    [2005] Me.Close vs. Me.Dispose

    In my MDI app, I'll often need to show a form modally (Form.ShowDialog). What I have noticed is that when I close the form with Me.Close, and then open that form again, it appears that not all of the module-level variables have been cleared (i.e. there are "holdovers" from the previous time the form was open). But when I close with Me.Dispose, I do get the expected result, i.e. subsequent times the form is open, it starts "fresh" as desired. However, Me.Dispose causes an annoying flicker when the form closes. What is the "best practice" here?
    "It's cold gin time again ..."

    Check out my website here.

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

    Re: [2005] Me.Close vs. Me.Dispose

    It sounds like its a GarbageCollection issue as th GC doesnt run exactly right after a object is closed which calls its dispose but perhaps not right away is what you are seeing.

    If there are any references to this object then that too can hold up the cleanup. Are these variables on the form or in a separate class? What about using them as properties of the form?
    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

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