Results 1 to 4 of 4

Thread: Closing out a form in Visual Basic

  1. #1
    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.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    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.

  3. #3
    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.

  4. #4
    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

Similar Threads

  1. Replies: 5
    Last Post: 25-05-2011, 10:21 PM
  2. Replies: 2
    Last Post: 02-05-2011, 07:06 AM
  3. Form Help in MS Visual Basic 2008!
    By NGV BalaKrishna in forum Software Development
    Replies: 5
    Last Post: 21-01-2010, 10:07 PM
  4. Visual basic crashes when viewing form
    By Bandish 555 in forum Windows Software
    Replies: 3
    Last Post: 23-06-2009, 06:04 PM
  5. simple login form in visual basic 6?
    By hariharan_00 in forum Software Development
    Replies: 3
    Last Post: 28-10-2006, 08:51 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,874,562.56476 seconds with 16 queries