Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 31-08-2009
Member
 
Join Date: Aug 2009
Posts: 18
Closing out a form in Visual Basic

Hi friends,

I have created an application in Visual Basic 6, where i have a splash form which calls main form, which calls many other forms too. But when i am trying to close the main form using unload me then steps through all of the unfinished procedures. Is there any way I can prevent this from happening and should i mention few global variables at the same time.
Reply With Quote
  #2  
Old 31-08-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Completely closing out a form

If that's the case then i would suggest you hide all your frames by using the following code
Code:
frmMain1.Hide
or
FrmMain1.Visible = False
or even 
frmMain1.Left= -10000 ' sticks the form way off screen
At the same time if you think that any form is very heavy then try to many the functions and variables as possible to a bas module. Also make a note that as as long as even a single variable on a form is active/needed then the form will stay in memory. If the function of the Main form is to call others then i would suggest you to use a Sub Main rather than a form to serve as a switchboard.
Reply With Quote
  #3  
Old 31-08-2009
Member
 
Join Date: Aug 2009
Posts: 18
Closing out a form in Visual Basic

Thanks for replying me but i don't want any of my form to be hiding, i need to completely clean NEW instance of the form, according to me a variable is still being active which is the root cause of my problem. How can I ensure that none of the variables are still needed.
Reply With Quote
  #4  
Old 31-08-2009
Member
 
Join Date: Dec 2008
Posts: 165
Closing out a form in Visual Basic

In that case simply move everything in declaration section of the form to bas module and also move procedures which are not directly linked to the form to the bas module and also remove any calls to the controls from modules or other forms or else you can also use the following code too

Code:
unload Mainform1
unload Mainform2

Dim frmOpen As form1
Set frmOpen = New form1
frmOpen.Show
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Closing out a form in Visual Basic"
Thread Thread Starter Forum Replies Last Post
Google Chrome is opening in basic HTML form instead of the Standard form Beatrix Technology & Internet 5 25-05-2011 10:21 PM
how to get items in a form to auto-resize with the form using visual basic deansmylie93 Software Development 2 02-05-2011 07:06 AM
Form Help in MS Visual Basic 2008! NGV BalaKrishna Software Development 5 21-01-2010 10:07 PM
Visual basic crashes when viewing form Bandish 555 Windows Software 3 23-06-2009 06:04 PM
simple login form in visual basic 6? hariharan_00 Software Development 3 28-10-2006 08:51 PM


All times are GMT +5.5. The time now is 01:27 AM.