How To: Form1.Close() leads to Error on Next Show
In VB.NET
If I issue a Form1.close()
and then re-open form again with Form1.Show
I get an System.ObjectDisposedException
New Info:
Use Form1.Hide() & Form1.Close() only when exiting application? Is this the best way?
# 1 Re: How To: Form1.Close() leads to Error on Next Show
The difference between .Hide and .Close in .NET is like the difference between .Hide and Unload in VB6. Use .Close if you want to free the memory and other resources used by the form; use .Hide if you simply want to make it invisible without freeing its resources.
If you .Close or .Dispose a form and want to show it again, you must use the New keyword to create a new instance of the form:
Dim frm As New Form1
frm.Show