compugeek Posted September 3, 2003 Posted September 3, 2003 Hello, I'm a newbie at these forums, and at VB.NET programming. How do you close an open window? I have tried varForm.Visible = False and varForm = Nothing, etc, but all it does is put it behind another form. Help! Thanks, -compugeek Quote
Administrators PlausiblyDamp Posted September 3, 2003 Administrators Posted September 3, 2003 varForm.Hide Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
mpgrewal Posted September 3, 2003 Posted September 3, 2003 Goto Help menu Select Index Type closing forms And read carefully Cheers Quote
compugeek Posted September 3, 2003 Author Posted September 3, 2003 Oh, thanks, I'll try that. PlausiblyDamp: Nope, same result. It dosen't work. Quote
compugeek Posted September 3, 2003 Author Posted September 3, 2003 Hm, nothing in the help files. Well, I hafta go right now; be back later. Quote
Administrators PlausiblyDamp Posted September 3, 2003 Administrators Posted September 3, 2003 Could you give a code sample because 1) what I suggested works fine for me. 2) seems unlikely there is nothing in the help files on hiding or closing a form Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
*Experts* mutant Posted September 3, 2003 *Experts* Posted September 3, 2003 If you want to completely close the form, not just hide it then simply use the Close() method of the form, it shoud work. Quote
samsmithnz Posted September 3, 2003 Posted September 3, 2003 What about the form.dispose method? that works too... Quote Thanks Sam http://www.samsmith.co.nz
*Experts* Bucky Posted September 3, 2003 *Experts* Posted September 3, 2003 If you Dispose() of the form, then its resources are freed and you can't open it again without reinitailizing the variable. Close() is the best way to close the form. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Experts* mutant Posted September 3, 2003 *Experts* Posted September 3, 2003 Close() method disposes of the form too. Quote
*Experts* Volte Posted September 3, 2003 *Experts* Posted September 3, 2003 I'm fairly sure Dispose() doesn't allow the Closed or Closing events to be called, so it's best to use Close over Dispose. Quote
aewarnick Posted September 3, 2003 Posted September 3, 2003 (edited) Yes, that makes sense VolteFace because I would usually get object reference not set to an instance if I used Dispose for a Form. So, consequently I use Close instead. Edited September 4, 2003 by aewarnick Quote C#
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.