Results 1 to 5 of 5

Thread: Unload Form w/Variables Or Invisible?

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    3

    Unload Form w/Variables Or Invisible?

    hi,

    My question is this:
    I have a main form, and then another sub form. The sub form has checkboxes which, when closed, the values must be read by the main form.

    Would it better to just set the sub form as invisble, hence using more memory and read the values directly
    or
    create global variables that store the data, and whenever the sub form is loaded, the variables load the data into the controls and whenever the sub form is unloaded the variables are updated.

    The second option of the 2 obviously requires more code, but would it be more efficient than keeping the form loaded but invisible? The sub form is just a small form that will be opened rarely but values must be read from it from the main.

    Thanks for your time.
    Last edited by karter69; Dec 8th, 2002 at 07:19 AM.

  2. #2
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    I would think it better coding practice to put it in global variables. This would also make it easier to edit/modify later on.

    cjqp

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    It is better practice not to use global variables. You can add custom properties to your sub form and set them depending on the values of your checkboxes. You can then unload the sub form and the custom properties will still be available. They stay available until to set the sub form = Nothing.

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    If just two forms, you can pass the values before unloading the first form :

    VB Code:
    1. Load Form2
    2.  
    3. Form2.Check1.Value = Form1.Check1.Value
    4.  
    5. Unload Form1
    6.  
    7. Form2.Show

    No additional declared variables, and no added module...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    3
    I think their may be some misunderstanding on what im asking...

    I have attached a project which should help.

    If i just close the sub form, which has the text box, it's value (checked or not) is lost.

    If i set it to invisible = False, the value is not lost because it has not been unloaded.

    My question is whether it is better to unload the sub form, and store the values in variables or just set it to invisible = False.

    The sub form will not be used often... by setting it to invisible = False instead of Unloading it, will it consume a substancial amount of more memory?

    Opinions are appreciated.

    Thanks
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width