Howdy, Stranger!

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

Categories

Proper Quit Procedure?

vmfedorvmfedor Member Posts: 28
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
«13

Comments

  • h4xx0rh4xx0r Member Posts: 43
    : 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 :)
  • JonathanJonathan Member Posts: 2,914
    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... ;-)

  • DarQDarQ Member Posts: 1,625
    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]

  • DarQDarQ Member Posts: 1,625
    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]

  • BarkeeperBarkeeper Member Posts: 335
    : 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

  • DarQDarQ Member Posts: 1,625
    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]

  • lionblionb Member Posts: 1,688 ✭✭
    : isnt an array a variable?? I set my arrays to nothing before ending the program.
    :
    How can you assign variable to nothing?!!
  • bednarjmbednarjm Member Posts: 82
    : 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

  • DarQDarQ Member Posts: 1,625
    : : 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]

  • lionblionb Member Posts: 1,688 ✭✭
    If it's Control Array - may be, otherwise - NO!!!!
«13
Sign In or Register to comment.