Proper Quit Procedure?

I've often been wondering if there is a 'correct' way (or even a built-in method) to end a program. Usually, I just use 'Unload Me' command where I want to quit and it works pretty well.. but it seems awfully sloppy to me and was curious if there was a better way of doing it. :)

Thanks in advance,
Vince
«1

Comments

  • : I've often been wondering if there is a 'correct' way (or even a built-in method) to end a program. Usually, I just use 'Unload Me' command where I want to quit and it works pretty well.. but it seems awfully sloppy to me and was curious if there was a better way of doing it. :)
    :
    : Thanks in advance,
    : Vince
    :

    Ya one day while I was doing my daily creeping around in the MSDN help in programming class I found this statement which seems to work well the MSDN speaks more highly of it than the Unload form1 or unload me. It is:

    set form1 = nothing

    where form1 is the name of the form you want unloaded. I think I know what you are thinking... you can do the exact same thing for variables (i think it started the other way round, being used for variables, then forms) Excuse my ramblings but seriously it works. For a variable do this:

    set string1 = nothing

    where string1 equals your variable. This statement COMPLETELY releases the object from memory, and therefore having a nice clean end statement :)
  • Hi,

    VB also has and End statement. I'm presuming that free's up anything and ends the program. :-)

    Jonathan

    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

  • Yes yes! This is required to do!! If you don't want your project to partially remain in the memory or proces list. Setting stuff to nothing is indeed more useful because it applies to almost all known identifiers such as objects or variables. You cant use unload to unload a variable..

    : : I've often been wondering if there is a 'correct' way (or even a built-in method) to end a program. Usually, I just use 'Unload Me' command where I want to quit and it works pretty well.. but it seems awfully sloppy to me and was curious if there was a better way of doing it. :)
    : :
    : : Thanks in advance,
    : : Vince
    : :
    :
    : Ya one day while I was doing my daily creeping around in the MSDN help in programming class I found this statement which seems to work well the MSDN speaks more highly of it than the Unload form1 or unload me. It is:
    :
    : set form1 = nothing
    :
    : where form1 is the name of the form you want unloaded. I think I know what you are thinking... you can do the exact same thing for variables (i think it started the other way round, being used for variables, then forms) Excuse my ramblings but seriously it works. For a variable do this:
    :
    : set string1 = nothing
    :
    : where string1 equals your variable. This statement COMPLETELY releases the object from memory, and therefore having a nice clean end statement :)
    :

    [HR]
    Gadver, ik wot ha'k hjir no wr?
    [HR]

    [GREEN]Anyone cares to translate?[/GREEN]

  • End is evil and cannot be used alone. TO actually end the program (After setting shit to nothing) you can use End.


    : Hi,
    :
    : VB also has and End statement. I'm presuming that free's up anything and ends the program. :-)
    :
    : Jonathan
    :
    : -------------------------------------------
    : Count your downloads:
    : http://www.downloadcounter.com/
    : And host your site:
    : http://www.incrahost.com/
    : Don't say I never give you anything... ;-)
    :
    :

    [HR]
    Gadver, ik wot ha'k hjir no wr?
    [HR]

    [GREEN]Anyone cares to translate?[/GREEN]

  • : Yes yes! This is required to do!! If you don't want your project to partially remain in the memory or proces list. Setting stuff to nothing is indeed more useful because it applies to almost all known identifiers such as objects or variables. You cant use unload to unload a variable..
    :
    : : : I've often been wondering if there is a 'correct' way (or even a built-in method) to end a program. Usually, I just use 'Unload Me' command where I want to quit and it works pretty well.. but it seems awfully sloppy to me and was curious if there was a better way of doing it. :)
    : : :
    : : : Thanks in advance,
    : : : Vince
    : : :
    : :
    : : Ya one day while I was doing my daily creeping around in the MSDN help in programming class I found this statement which seems to work well the MSDN speaks more highly of it than the Unload form1 or unload me. It is:
    : :
    : : set form1 = nothing
    : :
    : : where form1 is the name of the form you want unloaded. I think I know what you are thinking... you can do the exact same thing for variables (i think it started the other way round, being used for variables, then forms) Excuse my ramblings but seriously it works. For a variable do this:
    : :
    : : set string1 = nothing
    : :
    : : where string1 equals your variable. This statement COMPLETELY releases the object from memory, and therefore having a nice clean end statement :)
    : :
    :
    : [HR]
    : Gadver, ik wot ha'k hjir no wr?
    : [HR]
    :
    : [GREEN]Anyone cares to translate?[/GREEN]
    :
    :
    I always thought, that you can only set OBJECTS to Nothing, and not Variables.

    Set MyObject=Nothing --> correct
    Set MyString=Nothing --> Incorrect, since MyString is not an Object
    MyString=vbNullString --> correct
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • isnt an array a variable?? I set my arrays to nothing before ending the program.


    : : Yes yes! This is required to do!! If you don't want your project to partially remain in the memory or proces list. Setting stuff to nothing is indeed more useful because it applies to almost all known identifiers such as objects or variables. You cant use unload to unload a variable..
    : :
    : : : : I've often been wondering if there is a 'correct' way (or even a built-in method) to end a program. Usually, I just use 'Unload Me' command where I want to quit and it works pretty well.. but it seems awfully sloppy to me and was curious if there was a better way of doing it. :)
    : : : :
    : : : : Thanks in advance,
    : : : : Vince
    : : : :
    : : :
    : : : Ya one day while I was doing my daily creeping around in the MSDN help in programming class I found this statement which seems to work well the MSDN speaks more highly of it than the Unload form1 or unload me. It is:
    : : :
    : : : set form1 = nothing
    : : :
    : : : where form1 is the name of the form you want unloaded. I think I know what you are thinking... you can do the exact same thing for variables (i think it started the other way round, being used for variables, then forms) Excuse my ramblings but seriously it works. For a variable do this:
    : : :
    : : : set string1 = nothing
    : : :
    : : : where string1 equals your variable. This statement COMPLETELY releases the object from memory, and therefore having a nice clean end statement :)
    : : :
    : :
    : : [HR]
    : : Gadver, ik wot ha'k hjir no wr?
    : : [HR]
    : :
    : : [GREEN]Anyone cares to translate?[/GREEN]
    : :
    : :
    : I always thought, that you can only set OBJECTS to Nothing, and not Variables.
    :
    : Set MyObject=Nothing --> correct
    : Set MyString=Nothing --> Incorrect, since MyString is not an Object
    : MyString=vbNullString --> correct
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein
    :
    :

    [HR]
    Gadver, ik wot ha'k hjir no wr?
    [HR]

    [GREEN]Anyone cares to translate?[/GREEN]

  • : isnt an array a variable?? I set my arrays to nothing before ending the program.
    :
    How can you assign variable to nothing?!!
  • : I always thought, that you can only set OBJECTS to Nothing, and not Variables.
    :
    : Set MyObject=Nothing --> correct
    : Set MyString=Nothing --> Incorrect, since MyString is not an Object
    : MyString=vbNullString --> correct
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein
    :

    [blue]
    Your form is on object so it can be set to nothing.

    You are correct in that setting the string value to nothing will give an error (Object Required).
    [/blue]

    jim b

  • : : I always thought, that you can only set OBJECTS to Nothing, and not Variables.
    : :
    : : Set MyObject=Nothing --> correct
    : : Set MyString=Nothing --> Incorrect, since MyString is not an Object
    : : MyString=vbNullString --> correct
    : : ------------------------------------------
    : : Only stupidity of mankind and the universe
    : : are infinite, but i'm not sure concerning
    : : the universe. A. Einstein
    : :
    :
    : [blue]
    : Your form is on object so it can be set to nothing.
    :
    : You are correct in that setting the string value to nothing will give an error (Object Required).
    : [/blue]
    :
    : jim b
    :
    :

    [HR]
    Gadver, ik wot ha'k hjir no wr?
    [HR]

    [GREEN]Anyone cares to translate?[/GREEN]

  • If it's Control Array - may be, otherwise - NO!!!!
  • NOOO, its not a control array but an UDT array that contains an array as well! :((( Im sad...

    : If it's Control Array - may be, otherwise - NO!!!!
    :

    [HR]
    Gadver, ik wot ha'k hjir no wr?
    [HR]

    [GREEN]Anyone cares to translate?[/GREEN]

  • Prove it.

    : NOOO, its not a control array but an UDT array that contains an array as well! :((( Im sad...
    :
    : : If it's Control Array - may be, otherwise - NO!!!!
    : :

  • [b][red]This message was edited by lionb at 2002-10-29 7:55:25[/red][/b][hr]
    : Prove it.
    :
    That's for me or for DarQ?


  • : [b][red]This message was edited by lionb at 2002-10-29 7:55:25[/red][/b][hr]
    : : Prove it.
    : :
    : That's for me or for DarQ?

    For DarQ obviously. You haven't made any claims to prove.
  • cant prove. I have no VB and shit around here...
    and ofcourse, im afraid to become an idiot when it turnes out that i do NOT use nothing for my array but for the classes.
    : [b][red]This message was edited by lionb at 2002-10-29 7:55:25[/red][/b][hr]
    : : Prove it.
    : :
    : That's for me or for DarQ?
    :
    :
    :

    [HR]
    Gadver, ik wot ha'k hjir no wr?
    [HR]

    [GREEN]Anyone cares to translate?[/GREEN]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories