Re: Error Message VB6
- From: "Jan Hyde (VB MVP)" <StellaDrinker@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 Apr 2007 09:10:10 +0100
Ron <Ron@xxxxxxxxxxxxxxxxxxxxxxxxx>'s wild thoughts were
released on Thu, 12 Apr 2007 00:52:01 -0700 bearing the
following fruit:
Hi Rick
Perhaps in putting in the word ' End' confused the problem a little. In all
my programs I always set the Controlbox = False so the only way to leave a
form or the program is under my control, and the final action that the
program takes is to close all forms, and then 'End' but as has been pointed
out the word 'End' is a no no, point taken
but in my defense I have 3 books that say to do it that way.
A lot of people are taught to do it in class too. But now
you know better ;-)
OK now that I have removed the word 'End' from my program close button I
still get the same error can you help further please?
Which line of code does the error occur on?
J
"Rick Rothstein (MVP - VB)" wrote:
...try to unload the form with all the others before I use 'End'
I get the following error:-
Wrong Number of Arguments,or Invalid Property as I want to hide the form
and close at the end of the program can anyone offer a solution please.
Not sure if this is the source of your problem or not (although I kind of
suspect it is); but, from an old post of mine...
Never, never, never, never, ever use the End statement to terminate your
program.
End should ***NEVER*** be used in VB. When you start writing more complex
code, you will find that in certain situations, VB needs to do some cleaning
up (and you need to help it). You can go to this Google newsgroup link
http://groups.google.co.uk/advanced_group_search?num=100&as_scoring=d&as_ugroup=*.vb*
and look up the exact word "vb" and the exact phrase "end statement" (leave
off the quotes in both of these) to find the many ways people have explained
the why and what of not using the End statement. Suffice it to say that the
End statement stops your program in the same way running into a brick wall
stops your car... immediately. You don't get a chance to coast to a stop and
turn your key to the off position, open the door and exit the vehicle. The
same thing happens with the End statement... BOOM!, everything stops dead in
its tracks right then and there and the program ends. The moral is... NEVER,
NEVER, NEVER use the End statement in your program! (And, in the same way,
using that "solid square" icon on VB's Toolbar, or clicking End in the Run
menu, to stop your project during development is the identical equivalent of
executing an End statement in code... you shouldn't do that either.)
Consider this... From the VB Help Files: "More About Forms"
"The End statement ends an application immediately: no code after the End
statement is executed, and no further events occur. In particular, Visual
Basic will not execute the QueryUnload, Unload or Terminate event procedures
for any forms. Object references will be freed, but if you have defined your
own classes, Visual Basic will not execute the Terminate events of objects
created from your classes."
"In addition to the End statement, the Stop statement halts an application.
However, you should use the Stop statement only while debugging, because it
does not free references to objects."
Rick
.
- Follow-Ups:
- Re: Error Message VB6
- From: Ron
- Re: Error Message VB6
- References:
- Re: Error Message VB6
- From: Rick Rothstein \(MVP - VB\)
- Re: Error Message VB6
- From: Ron
- Re: Error Message VB6
- Prev by Date: Re: Error Message VB6
- Next by Date: Re: Error Message VB6
- Previous by thread: Re: Error Message VB6
- Next by thread: Re: Error Message VB6
- Index(es):