Yes. End does not free up resources correctly.
> Then is there any other method to END a program?
The app will automatically unload when all forms have unloaded and the code
is no longer processing.
Y2K is long past. Fix your system clock.
David Waddleton MCP,MCT
Waddleton Consulting Services
http://www.geocities.com/waddleton/
----------------------------------
In article <eCGcnp$j$GA....@cppssbbsa02.microsoft.com>,
Sent via Deja.com http://www.deja.com/
Before you buy.
This means you need to set all objects to Nothing, Erase all arrays, and
Unload all forms. Once you have completed this, using end should properly
terminate your program.
Example:
Sub ExampleCode()
Dim objX as Object
Dim intCount() as Integer
< do whatever you want with your code here >
Set objX = Nothing
Erase intCount
End Sub
Good Luck
Matthew Marcotte
khim <ltp...@tm.net.my> wrote in message
news:OYYWpV8j$GA.196@cppssbbsa04...
> hi all,
>
> i heard it's dangerous to use END? is this true?
>
> Then is there any other method to END a program?
> The reason is...i'm using Notes to launch a VB.exe program...and this exe
> should run on the background. after the process, then VB.exe should also
> automatically close and exit. That's why i need to use the END statement
> here.
>
> Any idea? Thanks
>
>
True, but in that case you no longer need to use it. END is only
needed when it is dangerous to use. Any time I pick up code with an
END it raises a big red flag that the developer may not have known what
he was doing and that I need to review everything in minute detail.
--
Please reply via the newsgroup only
Not looking to argue here, but I have been developing with VB since the
first release. If my memory recalls correctly, that would be back in 1988
or 1989.
There are times when VB executables do not cleanly release even when you
do unload all forms, erase all arrays, and set all objects equal to nothing.
At that point, you are relegated to using
the End statement. The interesting thing here is that a programmers code,
if written properly, should cleanly release all ties to any object it has
made connection with and should then release itself from memory. The only
way to be 100% sure that you have released your code from memory is to issue
a final End statement. If you do not do this, there is a chance that the
next application will have errors because of left over remnants from the
memory space your app could still be using.
It is unfortunate that you have not had decent experiences with using
the End statement and feel that scrutiny of another programmers code be
increased when you see the End statement appear. I can say that in my many
years of being in development lead positions that I have never seen the End
statement cause a problem. I have never needed to scrutinize any of my
programmers for the use of the End statement. Though, I do recall early in
the VB 3.0 era a programmer logging a complaint to MS about the End
statement not freeing resources correctly. I also recall a statement from
MS clarifying that the problem was usually brought on from improper program
termination caused by various different errors. The statement then pointed
back to the need for a good error handling routine for any program to
terminate cleanly when error\s occurred.
Sincerely,
Matthew
Bob Butler <butl...@my-deja.com> wrote in message
news:8b2reg$kf4$1...@nnrp1.deja.com...
> Not looking to argue here, but I have been developing with VB since the
>first release. If my memory recalls correctly, that would be back in 1988
>or 1989.
1991. It just seems longer.
Your experience is relatively unique. Most of the rest of us who have been
around that long, including myself, have been bitten badly by the use of End.
Some of us who are slow learners have been bitten many times. Perhaps we just do
more stuff on the bleeding edge that needs careful cleanup, but it remains truth
that using End is a crutch to get around proper cleanup. You advocate cleanup
and then End, but as has been pointed out by others, if you cleanup and then
unload the last form the program WILL END. If it does not, ipso facto it was not
properly cleaned up.
Don Bradner d...@arcatapet.com
MS VB MVP
I started with VB3 so your history goes back a few years more than
mine. I respect your opinion but your experience is apparently
different from mine as I have never seen a case where proper cleanup
did not result in the app ending properly. Anytime END was required it
meant that something was missed and adding END might appear to solve it
but in most cases END is used because the developer simply does not
understand the implications or the need for proper cleanup. It often
took time to trace down the real issue, but it was always a failure to
free allocated resources somewhere in the application.
>
> It is unfortunate that you have not had decent experiences with using
> the End statement and feel that scrutiny of another programmers code
be
> increased when you see the End statement appear. I can say that in my
many
> years of being in development lead positions that I have never seen
the End
> statement cause a problem. I have never needed to scrutinize any of my
> programmers for the use of the End statement. Though, I do recall
early in
> the VB 3.0 era a programmer logging a complaint to MS about the End
> statement not freeing resources correctly. I also recall a statement
from
> MS clarifying that the problem was usually brought on from improper
program
> termination caused by various different errors. The statement then
pointed
> back to the need for a good error handling routine for any program to
> terminate cleanly when error\s occurred.
>
> Sincerely,
>
> Matthew
Again, I appreciate the feedback and comments. I think I'm still going
to stick to my opinion that END is never needed and do some very
careful code review and testing anytime I pick up code that uses it.
I still have the first edition. The copyright date is 1989. Most
people did not pick up on it until it had been out on the market for quite
sometime. One of the biggest issues that I can remember sparking
discussions was in 1996 when a VB4 or 5 form would supposedly leave the
Virtual Machine space and still leave a ghost button on the Start bar.
If you get a chance, use pspy or something like that to monitor all
associated facets of a hefty VB app that does clean up after itself and also
does not use the End statement on a not so healthy box such as 486, Pentium
90, a newer box with less memory, etc. You will find that indeed the
process consumption is still present long after the process has supposedly
stopped. For some reason, apps that do not call the End statement do not
release efficiently. If you wait long enough (sometimes upwards of 20
minutes on slower boxes), the process will relinquish the memory. But do
you really want the user to have to wait that long. I do not think it is
fair that we eat the users box up this way. Sure, you can throw more memory
at the problem. But are we interested in causing the user to have to
increase their memory each time we release an app? One of the biggest
complaints I've heard over the years is, "The hardware keeps getting
stronger and capacities keep getting bigger. Those programmers keep
thinking its theirs to use too."
Regarding doing stuff on the bleeding edge, I have written utilities
that control the majority of the Win32API, perform most gaming type
functions around, handle full database scalability, etc.etc.etc. In the
early 90's, I helped develop software for a full blown 15,000 node on site
LAN that paralleled the Novell, preceded the Windows for Workgroups, and
preceded the Windows NT era with tools that allowed users to carry their
desktop color schemes, screen savers, printer settings, and so forth. I
have developed various high scale database systems that love to tax the CPU,
Memory, and IO. One of the biggest reasons I am confident about this issue
is that I have had to develop software for security purposes that monitor
processes and threads on both client and server boxes.
When it comes down to the final decision whether or not to use End, the
big issue is style and requirements at hand. If you don't care about
release time and available process space, don't use it.
Matthew Marcotte
Don Bradner <d...@arcatapet.com> wrote in message
news:nsbbds8bmqce410au...@4ax.com...
> "Matthew Marcotte" <matthew....@home.com> wrote:
>
> > Not looking to argue here, but I have been developing with VB since
the
> >first release. If my memory recalls correctly, that would be back in
1988
> >or 1989.
>
Of course, a missing End indicates that the person really wasn't sure when
their program would be completely cleaned up (not a confidence booster.)
"Matthew Marcotte" <matthew....@home.com> wrote in message
news:#NLu1ekk$GA.242@cppssbbsa03...
"David Mark" <dm...@shoptechcorp.com> wrote in message
news:#Ws88Knk$GA.263@cppssbbsa04...
End is not used at all by people who know what they are doing because
they understand that it is totally superfluous when used "correctly".
> Every time I pick up somebody
> else's VB app, I usually see so many big red flags that there is no
time to
> search out their End statement (usually a complete overhaul is needed
from
> beginning to end anyway.)
I totally agree that there are usually many big red flags raised when
looking at code. Checking out startup/shutdown routines is one of the
first things I tend to look at so I tend to see the End statement early
in the review process and it's one of the things I purposely look for
because it gives me a big clue that I should assume the worst about any
other questionable constructs since the coder obviously was unsure and
had to resort to End to get the application to terminate.
> Of course, a missing End indicates that the person really wasn't sure
when
> their program would be completely cleaned up (not a confidence
booster.)
<cut>
The existence of End is the flag that the person wasn't sure their app
would terminate. A "missing" End implies that they had some degree of
confidence that they had done all required cleanup and fully expected
their application to end cleanly. That also makes it a sign that there
is a good chance they had enough experience to actually write some
decent code. I've seen excellent code that included End and total
garbage that cleaned up properly but not often. Usually the use of End
has gone hand-in-hand with lots of other really bad practices.
We probably need to draw an end to this thread -- it is quite clear
that you are convinced that End has its place and will continue to use
it. It's also quite clear that we all agree that it is not required
when you have done proper cleanup and that it can be dangerous to use
when you don't bother to do that. As far as I can see, the main point
of disagreement is that you feel that End is useful to document the
fact that it is the point at which your app terminates and I believe
that it is pointless to include it when it is not needed (and that all
it can do is mislead inexperienced developers into thinking it is the
correct shutdown method). Nobody is convincing anybody of anything
here and we should probably agree to disagree while it's all still
civil.
I agree with you 100%. End is never necessary. If you have to use it then
make sure that your app will close without it...if your app does close
without it then why add it?
I've never had to use End in my life and have spent up to an hour sometimes
getting someone's app to close after I've removed the End but it can always
be done. Biggest reason for use of End is;
set frmMain = new frmMain
but not doing an Unload on that form. Some people don't realise that if you
only use one instance of a form you don't have to use Set to create that
instance. Other common mistakes are
frmMain.Property = 123
and again not unloading the form. I see people update properties of forms
on the Load even of some other form not realiseing that although the form
does not become visible, the act of accessing it loads it and it has to be
unloaded. IMHO using End can hide bugs and bad coding practices that will
never be learned due to the catch-all 'End' statement.
>Actually Don,
>
> I still have the first edition. The copyright date is 1989. Most
>people did not pick up on it until it had been out on the market for quite
>sometime.
We're getting into a bit of thread drift here, but 1991 is correct. I have no
idea why you would see a 1989 copyright date. Windows 3.0, which was required to
run VB1, was released on May 22,1990. Even a beta of VB1 in 1989 would not have
run.
The presence of "End" alone does not indicate much about the author, but
when I think that when used right, it tells future developers where the
program terminates. When used correctly, it is always superfluous, but
documents that the author knew where the application would terminate. A
quick glance around usually determines whether the author's usage was
correct or not.
>
> > Every time I pick up somebody
> > else's VB app, I usually see so many big red flags that there is no
> time to
> > search out their End statement (usually a complete overhaul is needed
> from
> > beginning to end anyway.)
>
> I totally agree that there are usually many big red flags raised when
> looking at code. Checking out startup/shutdown routines is one of the
> first things I tend to look at so I tend to see the End statement early
> in the review process and it's one of the things I purposely look for
> because it gives me a big clue that I should assume the worst about any
> other questionable constructs since the coder obviously was unsure and
> had to resort to End to get the application to terminate.
This is where I disagree with you. It is not quite that cut and dry.
I am getting tired of the thread as well. I just can't stand by while
people post things like "Don't use End under any circumstances" without
including more information about their train of thought (makes it sound like
there is a bug in VB that causes "End" to blow up your program.)
Face it, 99 out of 100 VB experts are going to tell you that End is BAD. If
you want to be that one lone voice, so be it. However, you shouldn't be
surprised if you are ostracized by the rest of the VB community for spouting
advice that is less than helpful to beginner and intermediate level
programmers. It certainly presents you in a bad light and my advice to anyone
reading posts with your name attached would be to think not only twice but
three or four times before implementing your suggestions. Furthermore, your
argumentative manor in this and other news groups shows a level of immaturity
that I have rarely seen in professional forums. If you wish to continue
contributing to these news groups, I suggest that you adopt a professional
candor before letting your fingers run wild at your keyboard.
Regards,
Bryan
_________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alp...@mvps.org Hunter S. Thompson -
MS MVP Visual Basic Fear and Loathing in LasVegas
I am certain that you define "expert" a bit more loosely than I do. I also
question your statistical accuracy.
> you want to be that one lone voice, so be it. However, you shouldn't be
I am right. I will continue to insist on that point.
> surprised if you are ostracized by the rest of the VB community for
spouting
I am not part of any VB community, but a much larger spectrum of developers
(and I receive enough "fan mail" for my VB "charity" work to choke an ox.)
> advice that is less than helpful to beginner and intermediate level
My advice on this matter is helpful. Shouting "End is BAD" doesn't teach
anybody anything. The truth is whispered. Lies are shouted about.
> programmers. It certainly presents you in a bad light and my advice to
anyone
Your light and advice do not add up to an empty coffee cup.
> reading posts with your name attached would be to think not only twice but
> three or four times before implementing your suggestions. Furthermore,
your
Why don't you think twice or three or four times before weakly attempting to
flame somebody.
> argumentative manor in this and other news groups shows a level of
immaturity
Your mother.
> that I have rarely seen in professional forums. If you wish to continue
> contributing to these news groups, I suggest that you adopt a professional
And you are going to stop me? I dare you to go cry to MS like Brad Martinez
did.
> candor before letting your fingers run wild at your keyboard.
I suggest that you f*#$ off!
>
> Regards,
> Bryan
>
> _________________________________________________________
> New Vision Software "When the going gets weird,"
Sucks. Do not buy anything from this lamer.
> Bryan Stafford "the weird turn pro."
Professional whiner?
Regards,
Bryan
That is typical of their cryptic documentation.
> releases later we know in more detail that END should not be used. I
> certainly know of no circumstances where a VB program will not terminate
if
> all of the forms and classes are properly unloaded. In every case where I
Doesn't anybody argue logically anymore? You think you are deflecting my
point, but sigh... See previous posts.
> have dealt with a program failing to terminate in 99.999% of the time it
is
> caused by unintentional implicit form loads: and most of those were
> references to the form to see if it was loaded, e.g. If form.visible=true
> then which effectively reloads the form. With the exception of the first
> load of the first form, all forms load invisible, consequently, accidental
> loads are often missed.
I am tired of this. End should be the last thing added to the app (and
should have not affect the execution of the program at all.) Don't use it
from now until eternity for all I care.
> > I am getting tired of the thread as well. I just can't stand by while
> > people post things like "Don't use End under any circumstances" without
> > including more information about their train of thought (makes it sound
> like
> > there is a bug in VB that causes "End" to blow up your program.)
> >
> > >
> Not looking to argue here,
Liar. <g>
>but I have been developing with VB since the
>first release.
Ditto.
>If my memory recalls correctly, that would be back in 1988
>or 1989.
'91.
> There are times when VB executables do not cleanly release even when you
>do unload all forms, erase all arrays, and set all objects equal to nothing.
Wrong. Period -- no room for argument here. Either take that back, or provide
sample code that demonstrates.
>At that point, you are relegated to using
>the End statement.
Wrong. At that point, you are "relegated" to actually examining your code and
finding your mistakes.
>The interesting thing here is that a programmers code,
>if written properly, should cleanly release all ties to any object it has
>made connection with and should then release itself from memory. The only
>way to be 100% sure that you have released your code from memory is to issue
>a final End statement.
Wrong.
>If you do not do this, there is a chance that the
>next application will have errors because of left over remnants from the
>memory space your app could still be using.
Not if it's not running. <g>
> It is unfortunate that you have not had decent experiences with using
>the End statement and feel that scrutiny of another programmers code be
>increased when you see the End statement appear.
If I see code that uses End, I *know* I'm dealing with an amatuer, and the code
should *not* be trusted. It is unfortunate that you're uncomfortable with the
reality of your own shortcomings.
>I can say that in my many
>years of being in development lead positions that I have never seen the End
>statement cause a problem.
Heh, now *that's* funny! <LOL>
Later... Karl
Bob Butler <butl...@my-deja.com> wrote in message
news:8b5egn$dp5$1...@nnrp1.deja.com...
> In article <#Ws88Knk$GA.263@cppssbbsa04>,
> "David Mark" <dm...@shoptechcorp.com> wrote:
> > I completely agree. End is used correctly by people who know what
> they are
> > doing and incorrectly by people who do not.
>
> End is not used at all by people who know what they are doing because
> they understand that it is totally superfluous when used "correctly".
>
> > Every time I pick up somebody
> > else's VB app, I usually see so many big red flags that there is no
> time to
> > search out their End statement (usually a complete overhaul is needed
> from
> > beginning to end anyway.)
>
> I totally agree that there are usually many big red flags raised when
> looking at code. Checking out startup/shutdown routines is one of the
> first things I tend to look at so I tend to see the End statement early
> in the review process and it's one of the things I purposely look for
> because it gives me a big clue that I should assume the worst about any
> other questionable constructs since the coder obviously was unsure and
> had to resort to End to get the application to terminate.
>
>> End is not used at all by people who know what they are doing because
>> they understand that it is totally superfluous when used "correctly".
>
>The presence of "End" alone does not indicate much about the author,
Well, let's take a look at that, eh? It *seems* that your argument is based on
maintaining your own self-esteem. "Hey look! I _know_ where _my_ program ends!"
That about it? Ummm, what were the other reasons again?
>I think that when used right, it tells future developers where the
>program terminates.
<LOL>
>When used correctly, it is always superfluous, but
>documents that the author knew where the application would terminate.
Sounds rather like a "security issue," imo. <g>
>quick glance around usually determines whether the author's usage was
>correct or not.
Any quick glance that noted End would definitely signal the mental capacity of the
original author, yes.
>> I tend to see the End statement early
>> in the review process and it's one of the things I purposely look for
>> because it gives me a big clue that I should assume the worst about any
>> other questionable constructs since the coder obviously was unsure and
>> had to resort to End to get the application to terminate.
>
>This is where I disagree with you. It is not quite that cut and dry.
Actually, yes, it is.
>> The existence of End is the flag that the person wasn't sure their app
>> would terminate. A "missing" End implies that they had some degree of
>> confidence that they had done all required cleanup and fully expected
>> their application to end cleanly. That also makes it a sign that there
>> is a good chance they had enough experience to actually write some
>> decent code. I've seen excellent code that included End and total
>> garbage that cleaned up properly but not often. Usually the use of End
>> has gone hand-in-hand with lots of other really bad practices.
>
>I am getting tired of the thread as well.
I'll bet! <vbg>
>I just can't stand by while
>people post things like "Don't use End under any circumstances" without
>including more information about their train of thought (makes it sound like
>there is a bug in VB that causes "End" to blow up your program.)
End _is_ a bug. HTH!
Later... Karl
>> you want to be that one lone voice, so be it. However, you shouldn't be
>
>I am right. I will continue to insist on that point.
And we'll just continue to view you as a *seriously* impaired developer. Cool.
>> surprised if you are ostracized by the rest of the VB community for
>> spouting
>
>I am not part of any VB community,
Technically, correct. You're just part of what the VB community considers sideshow
entertainment. HTH!
>(and I receive enough "fan mail" for my VB "charity" work to choke an ox.)
I suppose next you'll be telling us the size of your [organ], eh? Choke an ox with
that, too?
>> advice that is less than helpful to beginner and intermediate level
>
>My advice on this matter is helpful.
Yeah, if you're a consultant hard-up for work, looking to bail out those you offer it
to as their projects collapse on down the road.
>> programmers. It certainly presents you in a bad light and my advice to
>> anyone
>
>Your light and advice do not add up to an empty coffee cup.
Heh, highly skilled in the art of verbal jousting, too, I see. <ROFLMAO>
>> reading posts with your name attached would be to think not only twice but
>> three or four times before implementing your suggestions. Furthermore,
>> your
>
>Why don't you think twice or three or four times before weakly attempting to
>flame somebody.
Hey, lookee-here! Touché Turtle strikes again.
>> argumentative manor in this and other news groups shows a level of
>> immaturity
>
>Your mother.
Bwahahahahaaa! (Pathetic.)
>> that I have rarely seen in professional forums. If you wish to continue
>> contributing to these news groups, I suggest that you adopt a professional
>
>And you are going to stop me? I dare you to go cry to MS like Brad Martinez
>did.
Are you kidding? Get you added to a spam-filter? That's just too precious. I'd
rather see you ridiculed for the obvious blowhard poser that you are.
>> candor before letting your fingers run wild at your keyboard.
>
>I suggest that you f*#$ off!
Hey, swing by news://news.devx.com/off.ramp and say that. I dare ya. :-)
Later... Karl
You don't *know* squat. If you can't figure out in two seconds whether it
is a "documenting" end or a "panic because my program does not unload all
the way" end, then you are the "amatuer" (sic). And the opinions expressed
by the person you replied to are his own and do little or nothing to further
the argument going on in this thread. Basically, you shot a bystander.
Why even post lame BS like this, "No Spam Man" (if that is indeed your real
name.) And what is with all of the asterisks? Can't you get your point
across in plain english?
>
> >> surprised if you are ostracized by the rest of the VB community for
> >> spouting
> >
> >I am not part of any VB community,
>
> Technically, correct. You're just part of what the VB community considers
sideshow
> entertainment. HTH!
The VB community is largely a sideshow to me and you are one of the clown
princes.
>
> >(and I receive enough "fan mail" for my VB "charity" work to choke an
ox.)
>
> I suppose next you'll be telling us the size of your [organ], eh? Choke
an ox with
> that, too?
I suppose next I'll be telling you to f#*$ off.
>
> >> advice that is less than helpful to beginner and intermediate level
> >
> >My advice on this matter is helpful.
>
> Yeah, if you're a consultant hard-up for work, looking to bail out those
you offer it
> to as their projects collapse on down the road.
Not a consultant and you obviously do not understand the argument. Think
before you post.
>
> >> programmers. It certainly presents you in a bad light and my advice to
> >> anyone
> >
> >Your light and advice do not add up to an empty coffee cup.
>
> Heh, highly skilled in the art of verbal jousting, too, I see. <ROFLMAO>
As are you, pinhead. All you ever type is tired old abbreviations like
"ROFLMAO". Do you think that's witty or something? (I seem to recall a
previous e-mail conversation with this half-wit and remember why I cut it
off in the middle of one of these "ROFLMAO" fights.)
>
> >> reading posts with your name attached would be to think not only twice
but
> >> three or four times before implementing your suggestions. Furthermore,
> >> your
> >
> >Why don't you think twice or three or four times before weakly attempting
to
> >flame somebody.
>
> Hey, lookee-here! Touché Turtle strikes again.
That's almost as funny as the picture of you on your website. (You know,
the one that looks like Paul Allen as Indiana Jones.) You think you are
going to swing in here and save the day for the "End" detractors with a few
ill-placed smileys? What a waste.
>
> >> argumentative manor in this and other news groups shows a level of
> >> immaturity
> >
> >Your mother.
>
> Bwahahahahaaa! (Pathetic.)
(Clearly doesn't get it.)
>
> >> that I have rarely seen in professional forums. If you wish to
continue
> >> contributing to these news groups, I suggest that you adopt a
professional
> >
> >And you are going to stop me? I dare you to go cry to MS like Brad
Martinez
> >did.
>
> Are you kidding? Get you added to a spam-filter? That's just too
precious. I'd
> rather see you ridiculed for the obvious blowhard poser that you are.
You are an idiot. Not only that, but your are an idiot that almost never
posts here. Take your bwwaahhhaaa's and <ROTFLMAO>'s and go back to your
cave.
>
> >> candor before letting your fingers run wild at your keyboard.
> >
> >I suggest that you f*#$ off!
>
> Hey, swing by news://news.devx.com/off.ramp and say that. I dare ya. :-)
If you and your endless supply of stupid abbreviations are there, I will
clearly avoid it like the plague. Why don't you go back there where I don't
have to respond to your nonsensical ramblings.
>
> Later... Karl
>
I sincerely hope not.
>
>
PS. Your mother too, b#$%!
Go to the back of the class, half-wit. You are obviously not paying
attention.
David Mark wrote in message <#Eg5u6qk$GA...@cppssbbsa02.microsoft.com>...
>> If I see code that uses End, I *know* I'm dealing with an amatuer, and the
>> code
>
>You don't *know* squat.
Ouch. <LOL>
>If you can't figure out in two seconds whether it
>is a "documenting" end
That's precious. A "documenting" end, eh? Do you wear a nametag so you know who you
are when you look in the mirror, too?
>or a "panic because my program does not unload all
>the way" end,
There is no difference, as they both serve the same ultimate purpose.
>then you are the "amatuer" (sic).
Oooooowwwwwww, a *spelling* flame! A real pro, aren't you? <snicker>
See ya on the off.ramp?
Later... Karl
>> And we'll just continue to view you as a *seriously* impaired developer.
>> Cool.
>
>Why even post lame BS like this,
Why? Because "inquiring minds" need to know! <g>
>"No Spam Man" (if that is indeed your real name.)
Heheheheheh... You really *are* dumber than you type, aren't you?
This server's hell. If you wany my email address, you can either do your own search,
or (free clue warning!) hit my site <http://www.mvps.org/vb>. Of course, given that
*most* of the folks who use VB already know that address, I apologize to the majority
for the need to clue in the newbie here.
>And what is with all of the asterisks? Can't you get your point
>across in plain english?
It's nice to occassionally use <em>tags</em> without resorting to sucking bandwidth
(as you did in that 15K quote to which you attached ~15 really "pithy" words).
>> >> surprised if you are ostracized by the rest of the VB community for
>> >> spouting
>> >
>> >I am not part of any VB community,
>>
>> Technically, correct. You're just part of what the VB community considers
>> sideshow entertainment. HTH!
>
>The VB community is largely a sideshow to me and you are one of the clown
>princes.
Heh, so you do know me, huh? What a weasel.
>> >(and I receive enough "fan mail" for my VB "charity" work to choke an
>> >ox.)
>>
>> I suppose next you'll be telling us the size of your [organ], eh? Choke
>> an ox with that, too?
>
>I suppose next I'll be telling you to f#*$ off.
Big words, for a coward. C'mon by the Offramp -- I'm sure you'll find a receptive
crowd.
>> >> advice that is less than helpful to beginner and intermediate level
>> >
>> >My advice on this matter is helpful.
>>
>> Yeah, if you're a consultant hard-up for work, looking to bail out those
>> you offer it to as their projects collapse on down the road.
>
>Not a consultant and you obviously do not understand the argument.
I understand. Believe me, I understand. You're just a moron, bent on demonstrating
that fact, right?
>Think before you post.
Pot-kettle-black, d00d.
>> >> programmers. It certainly presents you in a bad light and my advice to
>> >> anyone
>> >
>> >Your light and advice do not add up to an empty coffee cup.
>>
>> Heh, highly skilled in the art of verbal jousting, too, I see. <ROFLMAO>
>
>As are you, pinhead.
:-)
>> >Why don't you think twice or three or four times before weakly attempting to
>> >flame somebody.
>>
>> Hey, lookee-here! Touché Turtle strikes again.
>
>That's almost as funny as the picture of you on your website. (You know,
>the one that looks like Paul Allen as Indiana Jones.) You think you are
>going to swing in here and save the day for the "End" detractors with a few
>ill-placed smileys? What a waste.
No, I just can't resist a good food-fight. Here, wipe that spittle off your chin...
>> >> argumentative manor in this and other news groups shows a level of
>> >> immaturity
>> >
>> >Your mother.
>>
>> Bwahahahahaaa! (Pathetic.)
>
>(Clearly doesn't get it.)
<g>
>> rather see you ridiculed for the obvious blowhard poser that you are.
>
>You are an idiot. Not only that, but your are an idiot that almost never
>posts here. Take your bwwaahhhaaa's and <ROTFLMAO>'s and go back to your
>cave.
Ow!
>> >> candor before letting your fingers run wild at your keyboard.
>> >
>> >I suggest that you f*#$ off!
>>
>> Hey, swing by news://news.devx.com/off.ramp and say that. I dare ya. :-)
>
>If you and your endless supply of stupid abbreviations are there, I will
>clearly avoid it like the plague. Why don't you go back there where I don't
>have to respond to your nonsensical ramblings.
Scared, aren't you?
Later... Karl
David Mark <dm...@shoptechcorp.com> wrote in message
news:Oo0Giwqk$GA....@cppssbbsa02.microsoft.com...
It does not introduce bugs unless there were bugs to begin with. I get the
feeling that most people posting here do not understand the basic argument.
Why add it? So that people that have to maintain your code later will know
where the end is (it is as simple as that.)
> defend to the death your right to add your own bugs to your own programs
but
> I really do object to your recommending this practice to others. I might
add
> that by any industry "best practices" guidelines, adding END to any
program
> that you write for third parties lays you open to legal action for
> malpractice. If your program is used on someone's web server and it brings
> that server down, and the investigation tracks back to your end statement,
Buddy, my programs run on lots of web servers and you can be sure that they
don't bring anything down (nor do they have end statements as they are
ActiveX servers.)
> then you will have to mount a very spirited defense indeed. If you really
> want to document the point at which the program ends, use the very nice
> facility provided by microsoft called a comment: it is more likely to be
> seen...
Comment goes after the End statement, not in lieu of.
> 'Classes gone, forms unloaded, on return from this procedure the program
> should terminate.
So why not make it complete with an end statement at this point. I don't
want to have to search for your particular "substitute for end" verbage.
"Karl E. Peterson" <ka...@no.spam.man> wrote in message
news:#zEukUrk$GA.263@cppssbbsa04...
"Karl E. Peterson" <ka...@no.spam.man> wrote in message
news:uAkpxZrk$GA.283@cppssbbsa04...
> Hi David!
>
> >> And we'll just continue to view you as a *seriously* impaired
developer.
> >> Cool.
> >
> >Why even post lame BS like this,
>
> Why? Because "inquiring minds" need to know! <g>
Grin. Oh boy!
>
> >"No Spam Man" (if that is indeed your real name.)
>
> Heheheheheh... You really *are* dumber than you type, aren't you?
>
> This server's hell. If you wany my email address, you can either do your
own search,
So you are scared of being spammed? And no, I do not want your email
address. Furthermore I do not want your lame opinions, on-the-cheap barbs
or wasteful meaningless posts.
> or (free clue warning!) hit my site <http://www.mvps.org/vb>. Of course,
given that
I hit your sh%$hole site years ago. Who cares?
> *most* of the folks who use VB already know that address, I apologize to
the majority
> for the need to clue in the newbie here.
As ususal, you are off in left field with no real comprehension of what you
are replying to. Why don't you spare net.humanity and get the f$#% out of
here.
>
> >And what is with all of the asterisks? Can't you get your point
> >across in plain english?
>
> It's nice to occassionally use <em>tags</em> without resorting to sucking
bandwidth
> (as you did in that 15K quote to which you attached ~15 really "pithy"
words).
Is it nice? I don't think it is all that nice at all. I think it is just
as lame as the rest of the crap you put in your posts.
>
> >> >> surprised if you are ostracized by the rest of the VB community for
> >> >> spouting
> >> >
> >> >I am not part of any VB community,
> >>
> >> Technically, correct. You're just part of what the VB community
considers
> >> sideshow entertainment. HTH!
> >
> >The VB community is largely a sideshow to me and you are one of the clown
> >princes.
>
> Heh, so you do know me, huh? What a weasel.
Yes, Indiana, I know who you are (though I wish I didn't.)
>I have never seen such a wannabe flamer.
Now, now, no need to bore us with your grooming habits.
>> >"No Spam Man" (if that is indeed your real name.)
>>
>> Heheheheheh... You really *are* dumber than you type, aren't you?
>>
>> This server's hell. If you wany my email address, you can either do your
>> own search,
>
>So you are scared of being spammed?
Courtesy is clearly something you need some lessons with. No, my postmaster is also
my friend. If I can save him continually adding more entries to his rejection
filters, he has more productive uses for his time.
>And no, I do not want your email
>address. Furthermore I do not want your lame opinions, on-the-cheap barbs
>or wasteful meaningless posts.
FU2. :-)
>> *most* of the folks who use VB already know that address, I apologize to
>> the majority for the need to clue in the newbie here.
>
>As ususal, you are off in left field with no real comprehension of what you
>are replying to. Why don't you spare net.humanity and get the f$#% out of
>here.
Take it to the OR, bub. Or, does that scare you?
>> >The VB community is largely a sideshow to me and you are one of the clown
>> >princes.
>>
>> Heh, so you do know me, huh? What a weasel.
>
>Yes, Indiana, I know who you are (though I wish I didn't.)
You will. ;-)
Later... Karl
David Mark wrote in message ...
>
>"Karl E. Peterson" <ka...@no.spam.man> wrote in message
>news:uFbeL1qk$GA.284@cppssbbsa04...
>> Hi David --
>>
>> >> End is not used at all by people who know what they are doing because
>> >> they understand that it is totally superfluous when used "correctly".
>> >
>> >The presence of "End" alone does not indicate much about the author,
>>
David Mark wrote in message <#seAohrk$GA...@cppssbbsa02.microsoft.com>...
>You are the weakest flamer I have ever encountered. No wit, no style and
>endless, tired abbreviations. Oh, evil grin, oh dear... Go back to
>whatever BS you were up to. Nobody here cares about posts like this.
>
>"Karl E. Peterson" <ka...@no.spam.man> wrote in message
> I completely agree. End is used correctly by people who know what they
are
> doing and incorrectly by people who do not.
True, but do *you* really know when to use it and when to not? I do.
Yes, there is a time to use it, and definitely a time to not use it.
It boils down to this -- if you are using a VB3 (or earlier) non-OLE app,
then yes, using End is appropriate. If you are using any type of
OLE-enabled (ActiveX) app (which was possible in VB3+) then you should not
use End, but rather *properly* close down your application (i.e. release all
objects, unload all forms, etc). One main reason for this, is that there is
no guarantee by OLE (ActiveX) that the objects (and any internal pointers,
etc to your app) will be released immediately upon doing so in VB code --
thus, even though you have taken all the proper steps to close down your
app, using End may cause some hanging references to your app, etc on the OLE
side of things -- if the OLE object tries referencing these pointers etc. in
the process of closing down, that is when crashes, etc. may occur.
IMHO, programmers that are still using End in post VB3 apps and getting away
with it, just happen to be lucky ;)
Doug Marquardt (VB MVP)
>One main reason for this, ...
Save your breath. That boy has no reason. Slap him with a trout, or something
suitably damp, instead. It's far more entertaining.
Anyone want to start a pool on when we'll push him over the edge? <bg>
Later... Karl
Chuck Grimsby <cdotg...@worldnetdotattdot.net> wrote in message
news:ajcddss4s7k5p1mu3...@4ax.com...
> On Mon, 20 Mar 2000 12:34:27 -0800, "Karl E. Peterson"
> <ka...@no.spam.man> wrote:
>
> >If I see code that uses End, I *know* I'm dealing with an amatuer, and
the code
> >should *not* be trusted.
>
> Uses End, or just has it in the code?
>
> Can you tell the difference at just a glance, or you do come to your
> conclusion after a through study of the code?
>
> If the End statement isn't executed, but is there, it's pretty much
> just a comment. You don't have anything against commented code, do
> you?
>
You really should not use End in this way. It *does* execute and can
prevent VB from properly doing its garbage collection.
> I =like= to see a nice clear ending point to a program. Guess I've
> been doing this programming thing too long, but I =want= to see it
> there as a visual clue as to where the program should be ending.
Then try this instead:
'End
If that doesn't work then something is wrong with your app.
Ray Mercer
MS-MVP Visual Basic
www.shrinkwrapvb.com
I'm relatively new to VB and have a project in which I've tried both
ways. At one point, if two textboxes are left empty, I prompt the user
for a response. If they select "Cancel", then I unload the form and
end the project. This project does not involve any other resources.
(No OLE, etc) Even though I set all pointers to Nothing and unload the
form, the procedure continues executing till finished (most
undesireable) -- unless I use "End". If unloading the form does not
cease execution and using "End" is taboo, what alternatives do I have?
I suppose at the "Unload" statement I could use "Exit Sub", but there
are purists who would bemoan that strategy as well.
I have an advanced Visual Basic text book that was written/reviewed by
9 (presumably) experts who use "Unload Me: End" throughout the text.
Do they not know what they are talking about? Could our educational
system be so far behind that they are relating bogus information? How
could a book, that by some of your standards be so wrong, get
published as a text book?
Good questions. And this illustrates well, why people should not make bold
statements about things they don't understand on public servers. It just
clouds the facts.
<gkn...@nospam.com> wrote in message
news:38d6eb8a....@news.proaxis.com...
> I'm curious as to this whole line of reasoning (and use the term
> loosely).
> I'm relatively new to VB and have a project in which I've tried both
> ways. At one point, if two textboxes are left empty, I prompt the user
> for a response. If they select "Cancel", then I unload the form and
> end the project. This project does not involve any other resources.
> (No OLE, etc)
The point is that there *is* something going on or the app *would* exit
correctly.
> Even though I set all pointers to Nothing and unload the
> form, the procedure continues executing till finished (most
> undesireable) -- unless I use "End".
OK, so what procedure is executing here? That is the key. You need to
figure out how to end this procedure. "End" is not the correct way.
> If unloading the form does not
> cease execution and using "End" is taboo, what alternatives do I have?
> I suppose at the "Unload" statement I could use "Exit Sub", but there
> are purists who would bemoan that strategy as well.
Unloading the main form should end your program (unless it is based on Sub
Main in which case reaching the end of the Sub should). If you are using
DoEvents or some other method of allowing different methods to execute
"simultaneously" then you need to rethink how you are handling re-entrancy
issues.
> I have an advanced Visual Basic text book that was written/reviewed by
> 9 (presumably) experts who use "Unload Me: End" throughout the text.
> Do they not know what they are talking about? Could our educational
> system be so far behind that they are relating bogus information? How
> could a book, that by some of your standards be so wrong, get
> published as a text book?
What book is it? They are wrong. Here is a quote from the Online Docs "End
Statement" entry:
>>>QUOTE
Note: The END statement stops code execution abruptly, without invoking the
Unload, QueryUnload, or Terminate event, or any other Visual Basic code.
Code you have placed in the Unload, QueryUnload, and Terminate events of
forms and class modules is no executed. Objects created from class modules
are destroyed, files opened using the Open statement are closed, and memory
used by your program is freed. Object references held by other programs are
invalidated.
The END statement provides a way to force your program to halt. For normal
termination of a Visual Basic program you should unload all forms. Your
program closes as soon as there are no other programs holding references to
objects created from your public class modules and no code executing.
<<<UNQUOTE
I really didn't make this stuff up see. Read the second paragraph above
again if you need reinforcement. I have been using VB since early VB3 days
and have learned from MS, from respected developers, and from the
documentation that End should not be used for normal program termination.
Hope this helps,
<gkn...@nospam.com> wrote in message
news:38d6eb8a....@news.proaxis.com...
> I'm curious as to this whole line of reasoning (and use the term
> loosely).
>
> I'm relatively new to VB and have a project in which I've tried both
> ways. At one point, if two textboxes are left empty, I prompt the user
> for a response. If they select "Cancel", then I unload the form and
> end the project. This project does not involve any other resources.
> (No OLE, etc) Even though I set all pointers to Nothing and unload the
> form, the procedure continues executing till finished (most
> undesireable) -- unless I use "End". If unloading the form does not
> cease execution and using "End" is taboo, what alternatives do I have?
> I suppose at the "Unload" statement I could use "Exit Sub", but there
> are purists who would bemoan that strategy as well.
>
'For example:
If SaveDocument() Then
Unload Me
Exit Sub
End if
Unloading a form causes it to be removed from memory, what do you
think would happen if it actually got removed when the Unload command
was issued?
Doc = 1
Do While UserEditing
StartEditing Doc
If mCancel Then
Unload Me
Else
SaveDocument
Doc = Doc + 1
End if
Loop
Stepping through the case where the user presses Cancel, the If statement
evaluates to True. That causes the Unload command to exetcute, so the cpu
jumps to somewhere else to process the Unload command. When thats done, it
returns only to find all the memory wiped clean (the unload command removed
the procedure) no commands, no data, nothing. That can't happen, the result
is too unpredictable, so while a procedure is executing, I'm betting VB puts
a lock on the memory so that it will not be corrupted while being used.
Once the procedure is finished, and no other code is executing in the form,
VB can (if present) release the lock and actually remove all of that form's
componants.
HTH
LFS
:It doesn't follow that just because you have unloaded the last form that
:there isn't something else you have to do before you execute. Vb respects
:that. In many ways you can think of END as a particularly nasty form of
:GOTO. If you can code all your other routines to avoid GOTO or even exit
:sub, then why not this one?
Well, I have read many comments about "End" and have noticed that the
programmers whom I've learned to respect (John Walkenbach for Excel,
Rod Stephens, etc) don't use "End" but I've never read anything
definitive on the subject. When my text uses "End", I wonder about the
validity of other statements, though not discounting any.
Philosophically, you live with Unload Me not
:unloading untiil efter the invoking procedure has completed, why is this
:last Unload any different? The last unload cannot occur until you have
:released all resources on the form, including the currently executing
:procedure. Even a Sub Main bas procedure is running under the control of a
:window that is unloaded on completion.
:VB is an event driven programming environment, just like Windows is. Each
:event is driven as a consequence of of a message queued to the window and
:each event is expected to complete properly. END bypasses that normality.
Then in a situation where a condition is either true or false, Unload,
or continue, the accepted strategy would be:
If true then
Continue
Else
Unload Me
Exit Sub
End if
...Yes? Presuming clean-up is accomplished in Query Unload?
:Even if you have written a perfect program that makes END safe, it literally
:only takes one quick fix at 4.00 in the morning to turn your perfect
:creation into the perfect nightmare - and if this is a program being
:maintained by someone else that someone else wouldn't dream of looking for
:an END statement in some obscure corner of the program, particularly as the
:symptoms in most cases are failures in some other process or are masked
:because the memory leak that might ensue never gets too critical or the
:machine is rebooted too often.
I've always ensured that clean-up was done as soon as possible to
avoid issues and generally put extra clean-up in Query Unload to be
safe -- naturally using Unload Me before End. But after reading some
of these posts, I believe I'll change my strategy. It's unfortunate
that those who teach and write texts are not better suited to the
tasks.
:
:<gkn...@nospam.com> wrote in message
:news:38d6eb8a....@news.proaxis.com...
:> I'm curious as to this whole line of reasoning (and use the term
:
:
:A more proper method to do as you want is (as you indicated):
:
:'For example:
:If SaveDocument() Then
: Unload Me
: Exit Sub
:End if
:
:Unloading a form causes it to be removed from memory, what do you
:think would happen if it actually got removed when the Unload command
:was issued?
:
:Doc = 1
:Do While UserEditing
: StartEditing Doc
: If mCancel Then
: Unload Me
: Else
: SaveDocument
: Doc = Doc + 1
: End if
:Loop
:
:Stepping through the case where the user presses Cancel, the If statement
:evaluates to True. That causes the Unload command to exetcute, so the cpu
:jumps to somewhere else to process the Unload command. When thats done, it
:returns only to find all the memory wiped clean (the unload command removed
:the procedure) no commands, no data, nothing. That can't happen, the result
:is too unpredictable, so while a procedure is executing, I'm betting VB puts
:a lock on the memory so that it will not be corrupted while being used.
:
:Once the procedure is finished, and no other code is executing in the form,
:VB can (if present) release the lock and actually remove all of that form's
:componants.
:
:HTH
:LFS
Yes, that helps. It makes sense to control the shutting down of all
resources. Although I believe I've used "End" safely, there is no
point in leaving possible secret little breeding grounds for disaster.
:
:gkn...@nospam.com wrote:
:>
>I have an advanced Visual Basic text book that was written/reviewed by
>9 (presumably) experts who use "Unload Me: End" throughout the text.
I'd be curious to know which book, and who these reviewers were.
>Do they not know what they are talking about?
Nope.
>Could our educational
>system be so far behind that they are relating bogus information?
Heh, absolutely.
>How could a book, that by some of your standards be so wrong, get
>published as a text book?
Publishers are mainly interested only in page count, not content. They have no
compelling urge to insure accuracy. (Accuracy costs _real_ money, and they're loathe
to give up their huge pimping fee. Average recompense for technical book reviewers
is on the order of 10 cents per page. How hard would you work for such a fee?) Only
the author's concern for his/her own good name figures into this part of the
equation.
Later... Karl
>>If I see code that uses End, I *know* I'm dealing with an amatuer, and the code
>>should *not* be trusted.
>
>Uses End, or just has it in the code?
Heh, now that's an interesting question!
>Can you tell the difference at just a glance, or you do come to your
>conclusion after a through study of the code?
A glance tells me enough, generally.
>If the End statement isn't executed, but is there, it's pretty much
>just a comment.
Right. It's a very strong comment on the ineptitude of the coder. If it's not being
executed, then obviously the "coder" hasn't a clue what's going on in their
application.
>You don't have anything against commented code, do you?
You tell me -- http://www.mvps.org/vb
Later... Karl
I noticed when I read Deborah Kurata's book "Doing Objects in Visual
Basic 5.0" (apologies for any spelling/wording errors in either name as
I'm typing it from memory) that she uses a final End statement in many
examples. It surprised me because her stuff is all well reasoned and
was a valuable help in molding my own habits for dealing with object
design. It grated every time I saw the End because it was so totally
unecessary and would tend to make new VB developers adopt the practice.
>> >9 (presumably) experts who use "Unload Me: End" throughout the text.
>>
>> I'd be curious to know which book, and who these reviewers were.
><cut>
>
>I noticed when I read Deborah Kurata's book "Doing Objects in Visual
>Basic 5.0" that she uses a final End statement in many examples.
Is that right? I'll definitely have a word with her about that.
>It surprised me because her stuff is all well reasoned and
>was a valuable help in molding my own habits for dealing with object
>design. It grated every time I saw the End because it was so totally
>unecessary and would tend to make new VB developers adopt the practice.
She's good, and generally not this careless.
Thanks... Karl
I'll dig out the book myself tonight and double-check. That's what I
remember but the old brain cells are dying fast these days.
> >It surprised me because her stuff is all well reasoned and
> >was a valuable help in molding my own habits for dealing with object
> >design. It grated every time I saw the End because it was so totally
> >unecessary and would tend to make new VB developers adopt the
practice.
>
> She's good, and generally not this careless.
Absolutely. I have gotten a lot from her writings and our local user
group recommends her books highly to all new VB developers.
>> >> I'd be curious to know which book, and who these reviewers were.
>> ><cut>
>> >
>> >I noticed when I read Deborah Kurata's book "Doing Objects in Visual
>> >Basic 5.0" that she uses a final End statement in many examples.
>>
>> Is that right? I'll definitely have a word with her about that.
>
>I'll dig out the book myself tonight and double-check. That's what I
>remember but the old brain cells are dying fast these days.
Enough of them remain, apparently, to dig this out. <g> I just spoke with her, and
your recollection is correct. (She's been appropriately spanked, too, fwiw. <bg>)
>> She's good, and generally not this careless.
>
>Absolutely. I have gotten a lot from her writings and our local user
>group recommends her books highly to all new VB developers.
I'm trying to talk her into joining us here, to defend herself. You can bet "Doing
Objects with VB7" won't use this style! (Not if my name remains in the credits,
dagnabbit! <g>)
Later... Karl
Rick
"khim" <ltp...@tm.net.my> wrote in message
news:OYYWpV8j$GA.196@cppssbbsa04...
> hi all,
>
> i heard it's dangerous to use END? is this true?
>
> Then is there any other method to END a program?
> The reason is...i'm using Notes to launch a VB.exe program...and this exe
> should run on the background. after the process, then VB.exe should also
> automatically close and exit. That's why i need to use the END statement
> here.
>
> Any idea? Thanks
>
>
Les F
Rick Rothstein <rick_ne...@email.com> wrote in message
news:#VzwDX7k$GA.248@cppssbbsa03...
LOL. She does indicate in a few places that End should never be used
in "components" and should not be used until ALL resources have been
released. I guess the distinction is the definition of "component".
AFAIC, standard EXEs should be coded the same way I code ActiveX
DLL/EXEs and anything else.
I've had a couple of people argue that if End is not used it is
possible that a bug in VB's cleanup of it's own stuff can result in the
app not going away. That's the closest anybody has come to a
reasonable argument for using it. Overall I still maintain that the
dangers outweigh the beenfits and if any bug exists, in my cleanup or
in VB's, I'd rather know about it so I can track it down than just mask
it.
Unload Me
Exit Sub
End if
...Yes? Presuming clean-up is accomplished in Query Unload?
:Even if you have written a perfect program that makes END safe, it literally
:only takes one quick fix at 4.00 in the morning to turn your perfect
:creation into the perfect nightmare - and if this is a program being
:maintained by someone else that someone else wouldn't dream of looking for
:an END statement in some obscure corner of the program, particularly as the
:symptoms in most cases are failures in some other process or are masked
:because the memory leak that might ensue never gets too critical or the
:machine is rebooted too often.
I've always ensured that clean-up was done as soon as possible to
avoid issues and generally put extra clean-up in Query Unload to be
safe -- naturally using Unload Me before End. But after reading some
of these posts, I believe I'll change my strategy. It's unfortunate
that those who teach and write texts are not better suited to the
tasks.
:
:<gkn...@nospam.com> wrote in message
:news:38d6eb8a....@news.proaxis.com...
:> I'm curious as to this whole line of reasoning (and use the term
:> loosely).
:>
:> I'm relatively new to VB and have a project in which I've tried both
:> ways. At one point, if two textboxes are left empty, I prompt the user
:> for a response. If they select "Cancel", then I unload the form and
:> end the project. This project does not involve any other resources.
:> (No OLE, etc) Even though I set all pointers to Nothing and unload the
:> form, the procedure continues executing till finished (most
:> undesireable) -- unless I use "End". If unloading the form does not
:> cease execution and using "End" is taboo, what alternatives do I have?
:> I suppose at the "Unload" statement I could use "Exit Sub", but there
:> are purists who would bemoan that strategy as well.
:>
:> I have an advanced Visual Basic text book that was written/reviewed by
:> 9 (presumably) experts who use "Unload Me: End" throughout the text.
:> Do they not know what they are talking about? Could our educational
:> system be so far behind that they are relating bogus information? How
:
:
Since I'll probably have to repost this, I'll make it brief. I see the
logic in not using "End", the text book is "Programming in Visual
Basic 6.0", Irwin McGraw Hill and boy do I hate naming names. (In the
case of Supernews.com however, I don't mind naming names). Actually,
the text book is beginning to advanced VB.
Gary
On Tue, 21 Mar 2000 14:25:44 -0800, "Karl E. Peterson"
<ka...@no.spam.man> wrote:
:
:
:
Randy
If News.ThisThread.Value < Useful Then
Unload Thread
END
End If
<grin>
Rick
<snapp -@- mediaone -.- net> wrote in message
news:38d87180...@nntp.ce.mediaone.net...
> > If News.ThisThread.Value < Useful Then
> > Unload Thread
> > End If
> Some would argue
>
> If News.ThisThread.Value < Useful Then
> Unload Thread
> END
> End If
But then we'd have to back into the thread and clean up those erroneous
arguments so that the thread unloads cleanly *without* the unneeded End
there.
Debug.Assert 0 = GetNumTimesUsedInMyApp(End)
Hope this helps
Ray Mercer ;-)
Exactly what I have been saying all along. Thanks for clearing this up.
I am for completeness and order as well.
>
> I =like= to see a nice clear ending point to a program. Guess I've
> been doing this programming thing too long, but I =want= to see it
> there as a visual clue as to where the program should be ending.
>
I like your way of thinking.
> Sort of like how some people like to have only 1 way out of a function
> or subroutine, others don't care if there's more then 1 "exit". (I
> prefer just the 1 myself, but I'm not prejudiced against those who can
> deal with more then one.)
Having more than one exit from a sub or function is definitely a problem.
>
> I guess I don't meet your standards. Too bad. But then, you're not
> very likely to "review" my work, nor I your's, so I suppose it's all
> moot.
>
Most VB apps are never reviewed (just demolished and rewritten a few years
later.). It is actually a problem, but what are you going to do?
Never mind this wanker. He is just trolling in hopes of sparking a flame
war with DevX. If you ignore him, maybe he will go away.
Hey, Douglas. Are you going to inject some sanity into this thread?
> > I completely agree. End is used correctly by people who know what they
> are
> > doing and incorrectly by people who do not.
>
> True, but do *you* really know when to use it and when to not? I do.
Yes I do. (But lose the Peterson-esque asterisks will you? They are
hurting my eyes.)
>
> Yes, there is a time to use it, and definitely a time to not use it.
>
> It boils down to this -- if you are using a VB3 (or earlier) non-OLE app,
> then yes, using End is appropriate. If you are using any type of
Right. (Though I haven't really thought about VB3 in a while.)
> OLE-enabled (ActiveX) app (which was possible in VB3+) then you should not
> use End, but rather *properly* close down your application (i.e. release
all
Right. ActiveX in VB3? You mean a client? I still say that my argument
holds for that as long as you destroy all of the objects beforehand.
> objects, unload all forms, etc). One main reason for this, is that there
is
> no guarantee by OLE (ActiveX) that the objects (and any internal pointers,
> etc to your app) will be released immediately upon doing so in VB code --
> thus, even though you have taken all the proper steps to close down your
> app, using End may cause some hanging references to your app, etc on the
OLE
> side of things -- if the OLE object tries referencing these pointers etc.
in
> the process of closing down, that is when crashes, etc. may occur.
>
> IMHO, programmers that are still using End in post VB3 apps and getting
away
> with it, just happen to be lucky ;)
If you close down properly (which most people do after a year or two of
banging their heads against the wall.), End is superfluous. If you do not
close down properly and do not use End, you will end up with an invisible
instance of your app running. So pick your poison: possible memory leaks or
agitation of ActiveX server processes or an invisible instance. Let me help
you make up your mind:
Picture yourself as a beginning VB programmer. Your app doesn't even create
any ActiveX objects. Now imagine that you have heard that End is bad (but
have no idea why.) You eliminate it from your app to be a good citizen in
the "VB community", without realizing that you have a hidden form that is
never unloaded. So now when the user clicks the icon on the start menu to
run your program, they get nothing. How so? Because they are using the
typical newbie method of ensuring that multiple instances are not run
(App.Previnstance.) So, what happens with the End. Nothing at all.
Everything is still perfect in this scenario.
I imagine that should put an end to all of the confusion. My position is
not that End is perfect, but that telling new people not to use it without
backing it up with an actual logical argument. It has been going on for
years and years and it always ends up with idiots like Karl Peterson jumping
in with a few dull barbs and a slew of smileys. Anything further on this
and I will just repost the preceding paragraph (will save a bit of time and
a lot of bandwidth.)
>
>
> Doug Marquardt (VB MVP)
>
>
>
>
> (But lose the Peterson-esque asterisks will you? They are
> hurting my eyes.)
I believe he picked that habit up from myself <g> (and I picked that up from
J.D. -- those in the MSBasic forum on CIS know who I mean ;)
> I still say that my argument
> holds for that as long as you destroy all of the objects beforehand.
The problem is, is that you (the VB programmer) do not know when the objects
are actually destroyed, you only tell VB to destroy/release them (i.e. Set
MyObject = Nothing). If you knew that (or at least were *guaranteed* by
OLE/ActiveX/COM) then using End would be ok -- but you don't, and the
problems that *may* occur by using End aren't worth the risk (IMHO).
> If you do not
> close down properly
That's the whole point -- it's up to you (the VB programmer) to have the
expertise to know how to do this.
> and do not use End, you will end up with an invisible
> instance of your app running. So pick your poison: possible memory leaks
or
> agitation of ActiveX server processes or an invisible instance.
Sounds to me like the reasoning here to use End is to save some
emabarrassment on behalf of the VB programmer who did not close down (or
perhaps code) the app properly.
>without realizing that you have a hidden form that is
> never unloaded.
Again, back to the old *experienced* VB programmer thingy -- lack of
knowledge about a language and how to use it is no excuse (IMHO).
Doug Marquardt (VB MVP)
I was not clearing it up or supporting your viewpoint. You did not
copy the rest of that paragraph: AFAIC, standard EXEs should be coded
the same way I code ActiveX DLL/EXEs and anything else.
There simply is no place for End in VB after VB 3.0; that is the
conclusion I have reached after much personal testing and much
discussion with other developers. If you want to keep using it that's
fine but do not be surprised when anytime you advocate it there are
multiple replies from people with the opposite opinion.
As for your not reading replies from Karl Peterson, that's your loss.
Karl has long been one of the most valued members of the newsgroups for
his expertise, patience and well-reasoned arguments. He just knows
when it isn't worth trying. I see many of your other posts that
indicate that you probably are a good developer but I'm personally
getting tired of the condescending attitude that comes across and the
immature name calling and use of profanities. They seriously undercut
your credibility. I'd always welcome another contributor to the
newsgroups but it looks to me like you have little or no experience
working with other developers because you definitely do not play well
with others.
He is a j#$%off. His off-topic, off-kilter and completely useless posts in
this thread have done nothing but make him look like the reject that he is.
He is clearly baiting me to cross-post in DevX (in short, he is nothing but
a troll.)
> when it isn't worth trying. I see many of your other posts that
> indicate that you probably are a good developer but I'm personally
> getting tired of the condescending attitude that comes across and the
> immature name calling and use of profanities. They seriously undercut
I have never called names or used (censored) profanities except when
directly attacked by people that don't realize that I have been helping
people in these VB groups for the better part of six years (though I am
usually short, I generally point people in the right direction.) I don't
have to help at all you know.
> your credibility. I'd always welcome another contributor to the
> newsgroups but it looks to me like you have little or no experience
> working with other developers because you definitely do not play well
> with others.
>
I play well with others just fine. Go back and read Alpine's post that
touched off this mess and then read the drivel that K*rl P*ters*n spewed out
afterwards. (You will see that I simply have no patience for off-topic
anything.)
Neil Moran
Three International
"David Mark" <dm...@shoptechcorp.com> wrote in message
news:eDJZXUAl$GA....@cppssbbsa02.microsoft.com...
>> >Absolutely. I have gotten a lot from her writings and our local user
>> >group recommends her books highly to all new VB developers.
>>
>> I'm trying to talk her into joining us here, to defend herself. You can bet "Doing
>> Objects with VB7" won't use this style! (Not if my name remains in the credits,
>> dagnabbit! <g>)
>
>LOL. She does indicate in a few places that End should never be used
>in "components" and should not be used until ALL resources have been
>released.
Yeah, that's how she responded to me, too. To which, of course, the only reaction is
that offered The Jerk -- why bother? It's pretty pointless if you've actually
released everything, and including it carries the potential of masking things you may
not have.
>I guess the distinction is the definition of "component".
>AFAIC, standard EXEs should be coded the same way I code ActiveX
>DLL/EXEs and anything else.
Yeah, why not, eh?
>I've had a couple of people argue that if End is not used it is
>possible that a bug in VB's cleanup of it's own stuff can result in the
>app not going away. That's the closest anybody has come to a
>reasonable argument for using it. Overall I still maintain that the
>dangers outweigh the beenfits and if any bug exists, in my cleanup or
>in VB's, I'd rather know about it so I can track it down than just mask
>it.
Absolutely!
Later... Karl
>I've tried to respond to these posts several times, but my news
>carrier "Supernews.com" is losing over 50 percent of my posts. GRRR...
Hmmm, why don't you just log directly onto this server?
>Since I'll probably have to repost this, I'll make it brief. I see the
>logic in not using "End", the text book is "Programming in Visual
>Basic 6.0", Irwin McGraw Hill and boy do I hate naming names.
Never heard of the authors. But, boy, the "reviews" on this one truly stink. The
most depressing thing was, when I just did a net.search on it, 95%+ of the hits were
to syllabi. :-(
See:
http://www.amazon.com/exec/obidos/ASIN/0072311908/o/qid=953745268/sr=8-2/002-9105887-
5886626
Thanks... Karl
>> As for your not reading replies from Karl Peterson, that's your loss.
>> Karl has long been one of the most valued members of the newsgroups for
>> his expertise, patience and well-reasoned arguments. He just knows
>
>He is a j#$%off. His off-topic, off-kilter and completely useless posts in
>this thread have done nothing but make him look like the reject that he is.
>He is clearly baiting me to cross-post in DevX (in short, he is nothing but
>a troll.)
Damn, you almost display an ability to recognize reality, here! Still scared to
face-off in a freespeech forum? One in which you won't feel like the "keyboard's got
your tongue" and the need to use that silly punctuation (as if you're hiding anything
<snicker>)? Betcha aren't up to it, are ya?
>> when it isn't worth trying. I see many of your other posts that
>> indicate that you probably are a good developer but I'm personally
>> getting tired of the condescending attitude that comes across and the
>> immature name calling and use of profanities. They seriously undercut
>
>I have never called names or used (censored) profanities except when
>directly attacked by people that don't realize that I have been helping
>people in these VB groups for the better part of six years (though I am
>usually short, I generally point people in the right direction.) I don't
>have to help at all you know.
Seems the general consensus here is, these groups would be *far* better off if you
just left. Heh, yeah, lots of help you are! Then again, there's something to be
said for learning by negative example.
>> your credibility. I'd always welcome another contributor to the
>> newsgroups but it looks to me like you have little or no experience
>> working with other developers because you definitely do not play well
>> with others.
>
>I play well with others just fine.
MUAHAAHAAHAAHAAHAAAAAAA!!! (Do not! ;-)
>(You will see that I simply have no patience for off-topic anything.)
Yeah, right. We'll see about that, won't we. <g>
Later... Karl
David Mark wrote in message ...
Sorry to hear about your drivel-situation. Best see your urologist at once.
HTH!
>Picture yourself as a beginning VB programmer. Your app doesn't even create
>any ActiveX objects.
Free Clue: Most beginners aren't aware that they can create apps without forms. IOW,
they've *never* created an app that doesn't create ActiveX objects. What's that?
You didn't know forms were said objects? <ROFL>
>in with a few dull barbs and a slew of smileys. Anything further on this
>and I will just repost the preceding paragraph (will save a bit of time and
>a lot of bandwidth.)
Yep, it'll reconfirm you haven't yet collected the requisite Free Clue's to be worth
listening to. :-)
Later... Karl
>> (But lose the Peterson-esque asterisks will you? They are
>> hurting my eyes.)
>
>I believe he picked that habit up from myself <g> (and I picked that up from
>J.D. -- those in the MSBasic forum on CIS know who I mean ;)
Brings +back+ the memories! (JDE didn't use asterisks until much later. ;-)
>> and do not use End, you will end up with an invisible
>> instance of your app running. So pick your poison: possible memory leaks or
>> agitation of ActiveX server processes or an invisible instance.
>
>Sounds to me like the reasoning here to use End is to save some
>emabarrassment on behalf of the VB programmer who did not close down (or
>perhaps code) the app properly.
Ba-ba-bing! This boy's only real argument is that he doesn't know when (or even if!)
his app ends, so, by god, he's gonna End it where and when he says it does!
Thanks... Karl
David Mark wrote in message <#XInIlAl$GA....@cppssbbsa02.microsoft.com>...
"Neil Moran" <Neil....@BTInternet.comNOSPAM> wrote in message
news:uCQRsACl$GA....@cppssbbsa02.microsoft.com...
> Could you add me to that list as well
>
> Neil Moran
> Three International
>
> "David Mark" <dm...@shoptechcorp.com> wrote in message
> news:eDJZXUAl$GA....@cppssbbsa02.microsoft.com...
1. K*rl P*t*rs*n
2. Neil Mor*n
3. A*****
Perhaps if they reconfigure their lives and appeal to me through proper
channels, I will reinstate their posting privileges.
:Hi Gary --
:
:>I've tried to respond to these posts several times, but my news
:>carrier "Supernews.com" is losing over 50 percent of my posts. GRRR...
:
:Hmmm, why don't you just log directly onto this server?
I've never done that. I'll have to look into it.
:
:>Since I'll probably have to repost this, I'll make it brief. I see the
:>logic in not using "End", the text book is "Programming in Visual
:>Basic 6.0", Irwin McGraw Hill and boy do I hate naming names.
:
:Never heard of the authors. But, boy, the "reviews" on this one truly stink. The
:most depressing thing was, when I just did a net.search on it, 95%+ of the hits were
:to syllabi. :-(
:
:See:
:http://www.amazon.com/exec/obidos/ASIN/0072311908/o/qid=953745268/sr=8-2/002-9105887-
:5886626
:
:Thanks... Karl
Hello Karl,
I checked out the reviews. Not too good. Fortunately, I had worked
with VB for a couple years prior to the class so I wasn't too confused
by the book. Thanks for your input.
Gary
HEY Karl!! You and me's in the top ten!!
I feel SOOOO, *VERY* BAD about hurting the poor, poor fourteen year-old's
feelings!! ;-) (Let's see...... He said he has been posting his unhelpful
drivel here for six years.... seven and six are thirteen.... Sorry, I was
wrong he's a thirteen year-old ;-) ).
Hummmm..... I wonder if his employer knows how much time he spends here
spouting profanity under the company domain name.......
Regards,
Bryan
_________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alp...@mvps.org Hunter S. Thompson -
MS MVP Visual Basic Fear and Loathing in LasVegas
>HEY Karl!! You and me's in the top ten!!
<g>
>I feel SOOOO, *VERY* BAD about hurting the poor, poor fourteen year-old's
>feelings!! ;-) (Let's see...... He said he has been posting his unhelpful
>drivel here for six years.... seven and six are thirteen.... Sorry, I was
>wrong he's a thirteen year-old ;-) ).
A liar too, as it happens. This server wasn't here six years ago!
Later... Karl
David Mark wrote:
> Picture yourself as a beginning VB programmer. Your app doesn't even create
> any ActiveX objects. Now imagine that you have heard that End is bad (but
> have no idea why.) You eliminate it from your app to be a good citizen in
> the "VB community", without realizing that you have a hidden form that is
> never unloaded. So now when the user clicks the icon on the start menu to
> run your program, they get nothing. How so? Because they are using the
> typical newbie method of ensuring that multiple instances are not run
> (App.Previnstance.) So, what happens with the End. Nothing at all.
> Everything is still perfect in this scenario.
>
> I imagine that should put an end to all of the confusion. My position is
> not that End is perfect, but that telling new people not to use it without
> backing it up with an actual logical argument. It has been going on for
> years and years and it always ends up with idiots like Karl Peterson jumping
> in with a few dull barbs and a slew of smileys. Anything further on this
> and I will just repost the preceding paragraph (will save a bit of time and
> a lot of bandwidth.)
I cannot remember if I ever saw a necessary use of End. If it is never needed,
common sence tells you to leave it out.
The beginner you cited is sure to compile his program a time or two, and try it
out, in the normal coarse of development. If he is smart enough to have used
App.PrevInstance, surely he was curious enough to test if it works. Or, it is
as likely to happen that he makes and runs an exe to test for trouble spots. After
a revision, he mindlessly tries to make another exe only to be confronted with an
access error. "Hmmm, can't save? Try closing exe. That didn't get...."
If the app really has a problem closing down, he will notice, and if it is over
his head he is going to go looking for help. If he comes here, I'm going to tell
him to pull that End out of there, and "close down properly"!
:)
LFS
>Kewl! Anyone else wanna get in on this, while the gettin's good?
I'm nowhere as good at it as you are, so if I join in I'm not sure I can get him
to ban me. Still, the way he's filtering we need to recruit more people with
common names like mine so that he winds up with nobody left to talk to. Either
that or we all should add "Karl" to our posting names and we can carry on
without him!
Personally I think you should just post as David Mark. That way we would see
some decent posts from him, and he could filter himself out.
Don Bradner d...@arcatapet.com
MS VB MVP
>I have never called names or used (censored) profanities except when
>directly attacked by people that don't realize that I have been helping
>people in these VB groups for the better part of six years (though I am
>usually short, I generally point people in the right direction.) I don't
>have to help at all you know.
I'm always curious about such assertions (timewise). Hard to know what you mean
by "these VB groups" since you may typically post somewhere else, but literally
"these VB groups" haven't existed for the better part of six years. Back then,
msnews did not exist and we (including Microsoft and Karl) were all on
Compuserve; believe me we would remember you (I also still have all those
postings archived, if you want to insist you were there). I'm interested in your
evolution as a poster, so I wonder if you would mind telling us where, and under
what name@where?
dm...@shoptechcorp.com appears to have a posting life in the usenet world of
just 16 days, albeit 1800 posts in that time.
>>Kewl! Anyone else wanna get in on this, while the gettin's good?
>
>I'm nowhere as good at it as you are,
Practice makes perfect! <g>
>so if I join in I'm not sure I can get him to ban me.
Looks like he's offered it up for simple request, at this point.
>Still, the way he's filtering we need to recruit more people with
>common names like mine so that he winds up with nobody left to talk to.
I noticed that, too, yeah. Gives you a really good feeling about the quality of his
code, ergo his "advice," too, don't it?
>Either
>that or we all should add "Karl" to our posting names and we can carry on
>without him!
LOL! Perfect!
Why, I'd be, well, extremely honored if y'all chose to do that! Certainly would be
talked about for years to come. :-)
>Personally I think you should just post as David Mark. That way we would see
>some decent posts from him, and he could filter himself out.
ROFLMAO!!! Oh, now that _truly_ would be evil, wouldn't it? I like it!
Later... David
| that or we all should add "Karl" to our posting names and we can carry on
| without him!
Sounds like a plan!
| Personally I think you should just post as David Mark. That way we would
see
| some decent posts from him, and he could filter himself out.
Sounds even better!
--
Randy Birch, MVP Visual Basic
http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/
news://news.mvps.org/
Why would you say that? From a purely "neatness" standpoint it may be
preferable to know that all procedure code executed to the end of the
procedure, but this is purely cosmetic. From a practical viewpoint, it makes
sense to exit a procedure once the procedure has completed the required
task, or determined that an early exit was in order. I see no reason to fall
through to the end of a routine, most probably wasting cycles executing
other lines of code that were dependant on previous successes (ie If True
then ..). Leaving at the "earliest convenient point" seem the most prudent.
--
Randy Birch, MVP Visual Basic
"David Mark" <dm...@shoptechcorp.com> wrote in message
news:eIL9sbAl$GA....@cppssbbsa02.microsoft.com...
|
| "Chuck Grimsby" <cdotg...@worldnetdotattdot.net> wrote in message
| news:40cdds8u5apmidufj...@4ax.com...
| > On Mon, 20 Mar 2000 15:01:52 GMT, Bob Butler <butl...@my-deja.com>
| > wrote:
| >
| > >End is not used at all by people who know what they are doing because
| > >they understand that it is totally superfluous when used "correctly".
| >
| > I =always= put an End in, even though it never executes. It's just my
| > way of thinking.
|
| I am for completeness and order as well.
|
| >
| > I =like= to see a nice clear ending point to a program. Guess I've
| > been doing this programming thing too long, but I =want= to see it
| > there as a visual clue as to where the program should be ending.
| >
|
| I like your way of thinking.
|
| > Sort of like how some people like to have only 1 way out of a function
| > or subroutine, others don't care if there's more then 1 "exit". (I
| > prefer just the 1 myself, but I'm not prejudiced against those who can
| > deal with more then one.)
|
| Having more than one exit from a sub or function is definitely a problem.
|
| >
| > I guess I don't meet your standards. Too bad. But then, you're not
| > very likely to "review" my work, nor I your's, so I suppose it's all
| > moot.
| >
|
| Most VB apps are never reviewed (just demolished and rewritten a few years
| later.). It is actually a problem, but what are you going to do?
|
|
He probably meant comp.lang.basic etc. which were around long before
Microsoft (and CompuServe) discovered the Internet. Maybe it's time to go
back and check up on old comp.lang.basic.visual.misc since this group's been
taken over by the junior high crowd. (That's probably not fair to kids in
junior high, the one's I know act more mature than this.)
>He probably meant comp.lang.basic etc. which were around long before
>Microsoft (and CompuServe) discovered the Internet. Maybe it's time to go
>back and check up on old comp.lang.basic.visual.misc since this group's been
>taken over by the junior high crowd. (That's probably not fair to kids in
>junior high, the one's I know act more mature than this.)
<g>
That's why I said "Hard to know what you mean by 'these VB groups'," giving him
the benefit of the doubt. I was serious about his 1800 posts in 16 days being
the entire existence of his current posting address, so if he did post on clvb*
it was under some other alias. I would like to see how he got to be the way he
is, so if he can provide a former alias I would like to go back and have a look.
Might be enlightening.
It looks like my dates are correct for a change though.
Gary
On Wed, 22 Mar 2000 22:13:50 GMT, gkn...@nospam.com wrote:
Hey, really, let's take a trip over to news://news.devx.com/off.ramp - I'll give
you a hand. It'll be fun, promise.
Zane Thomas (za...@mabry.com)
President - Mabry Software Inc.
www.mabry.com
"David Mark" <dm...@shoptechcorp.com> wrote in message
news:#Udqf6Cl$GA.176@cppssbbsa05...
> This is the list of people that are banned from this newgroup (they are on
> I have never called names or used (censored) profanities except when
> directly attacked by people that don't realize that I have been helping
> people in these VB groups for the better part of six years (though I am
> usually short, I generally point people in the right direction.) I don't
> have to help at all you know.
>
Under what aliases and on what forums do you claim to "have been helping
people in these VB groups for the better part of six years "