|
-
Mar 26th, 2008, 12:47 PM
#1
Thread Starter
PowerPoster
[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.
-
Mar 26th, 2008, 12:54 PM
#2
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|