The Lounge is rated PG. If you're about to post something you wouldn't want your
kid sister to read then don't post it. No flame wars, no abusive conduct, no programming
questions and please don't post ads.
And if you saw that on a code review you'd start swearing!
Worse, it propagates through subfunctions until another On Error is met - so you may never know that your code failed a hundred calls deep. It just continues as if the error line had not existed until it becomes totally impossible to ignore by which time the actual source of the error well and truly forgotten; the method may not even be in the call stack any more! And by then your DB is horribly corrupt ...
Sent from my Amstrad PC 1640 Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
I've seen pretty much exactly that at one of the companies I worked at.
Ok, it wasn't every line of code, but every method at least (and sometimes multiple per method).
And yes, it was VB.NET (but no On Error Resume Next, it only had a few of those)
It still has On Error Resume Next - so it's still garbage.
Not knowing how to code doesn't make the language garbage it makes the coder garbage.
This is not knowing how to code:
objShell.Run strRunCmd, 1, True
This is how to handle the error properly and reset properly:
objShell.Run strRunCmd, 1, True'True means wait for the app to exit before continuing the scriptIf Err.Number <> 0Then
ErrMsg Err.Number, Err.Description, "Error with objShell.Run [" & strRunCmd & "]", TrueEndIfOnErrorGoTo0
If you don't like it, don't use it. All of you VB haters make me laugh. Calling something that is used by thousands of programmers "Garbage", is just childish. The opposite of love isn't hate, it's indifference.
Seriously you are on this same issue, get over it, most of us here don't give a rats about the index and put very little faith in the veracity of it's results. Why would we, the majority of us use c# and live peaceably with the VB.net community despite the barrage of insult hurled at them from time to time.
Never underestimate the power of human stupidity