I hoped that had died...
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Please! Never ever spoke to me again! Filthy VB lover... :laugh:
Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
It is disgusting, just like
try {
// 8,000 lines of nested crap
} catch (Exception ex) { }veni bibi saltavi
-
It is disgusting, just like
try {
// 8,000 lines of nested crap
} catch (Exception ex) { }veni bibi saltavi
It's worse than that! It's like:
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
... repeated 8000 times...X|
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
It's worse than that! It's like:
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
try {
// A single line of code
} catch (Exception ex) { }
... repeated 8000 times...X|
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I once saw:
On Error Goto ErrorHandler
' 8,000 lines of really bad VB
ErrorHandler:
MsgBox err 'can't remember format
resume 'yup, goes back to the line what errored!veni bibi saltavi
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I saw it and my first advice was to remove it. Then to improve the code :p Unfortunately, no, its not dead, there are still VB6 programmers - I'm currently working on a project that was written by VB6 turned VB.NET programmer and I'm still refactoring whenever I get the chance. I have DAL interface with all data access methods defined in there...and I don't have time to split it so I continue adding to it when changing existing code. It is at 300+ methods right now. With two concrete classes implementing it. X|
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I know an old VB dinosaur who does it almost right...
Try
' Code... Mostly like:
Dim sCode As String = 123 ' Yes, this is possible with Option Strict Off (the default).
Dim Id As Integer ' From hungarian to PascalCase...
Dim someOtherVar As String ' And then correct camelCast, all in one method.
Catch (ex As Excpetion)
Log(Err.Message) ' Err, because why use ex?
End TryI used to see this pre-.NET VB mixed with VB.NET a lot :rolleyes:
Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Ah, you would love Rx then, there is something called Retry there :D Click and cry[^]
-
Ah, you would love Rx then, there is something called Retry there :D Click and cry[^]
Retry actually makes sense: sometimes you have to wait for something to "wake up" so doing it three times before failing isn't a bad idea. Be a nice addon to C#:
retry (3)
{
MyOperation();
}
catch (Exception ex)
{
...
}Or even just
try (3)
{
MyOperation();
}
catch (Exception ex)
{
...
}Mind you, it'd also be nice to have
try
with a timespan timeout which caused acatch
sometimes.Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Retry actually makes sense: sometimes you have to wait for something to "wake up" so doing it three times before failing isn't a bad idea. Be a nice addon to C#:
retry (3)
{
MyOperation();
}
catch (Exception ex)
{
...
}Or even just
try (3)
{
MyOperation();
}
catch (Exception ex)
{
...
}Mind you, it'd also be nice to have
try
with a timespan timeout which caused acatch
sometimes.Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I think you can with Rx, but It will involve some nasty code. If you look in the link I posted you can retry infinitely many times:
public static void RetrySample<T>(IObservable<T> source)
{
source.Retry().Subscribe(t=>Console.WriteLine(t)); //Will always retry
Console.ReadKey();
}So all you have to do is to enclose the subscription in an Observer, and set a timerinterval for desubscription by using an IObserver class.
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
OriginalGriff wrote:
Why isn't this abortion dead?
When you have a function that calls an external process and you don't care if it generates an error or not, then it works great. If it does generate an error it's an external process and nothing you can do about it and you still want the rest of your code to run.
There are only 10 types of people in the world, those who understand binary and those who don't.
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
There was a "question" back in April which was basically a rant about how C# sucked because it didn't have this "feature". The OP was insistent that his code was perfect, and he just wanted to ignore Microsoft's errors. :doh:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
The worst part of this is that I find a whole bunch of vendors that do this crap, too! I deal with Dynamics GP, where customizations can be written in VBA. I had a major error in one window where it kept dumping the user into VBA, bypassing all security. I contacted the vendor, and (sort of politely) requested they get their **** together. They sent me updated code... First line?
On error resume next
I lost it! They were confused why we changed vendors within a week after that...
-
There was a "question" back in April which was basically a rant about how C# sucked because it didn't have this "feature". The OP was insistent that his code was perfect, and he just wanted to ignore Microsoft's errors. :doh:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Richard Deeming wrote:
The OP was insistent that his code was perfect, and he just wanted to ignore Microsoft's errors.
You know, sometimes natural selection is just too damned slow.
Software Zen:
delete this;
-
...just answered a VB .NET question in QA, and the first line of his method is...
On Error Resume Next
I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I used it once, in a mini-prog that just creates empty, numbered ZIP or RAR files. The code was so simple that any potential "real" errors were dealt with without hardly having to think about them, so the only thing to worry about was if someone tried to create files with the same filenames as existing file (which I'd set to fail). It simply wasn't worth the effort of catching the error, so I just let it happen and Resumed Next.
I wanna be a eunuchs developer! Pass me a bread knife!