Click here to Skip to main content
15,897,371 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Constants definitions Pin
supercat911-Dec-07 9:07
supercat911-Dec-07 9:07 
GeneralRe: Constants definitions Pin
Frank Dawson10-Dec-07 15:25
Frank Dawson10-Dec-07 15:25 
GeneralRe: Constants definitions Pin
KarstenK12-Dec-07 22:47
mveKarstenK12-Dec-07 22:47 
GeneralRe: Constants definitions Pin
CurtD13-Dec-07 13:05
CurtD13-Dec-07 13:05 
GeneralThis one made me sigh Pin
CARPETBURNER6-Dec-07 0:40
CARPETBURNER6-Dec-07 0:40 
GeneralRe: This one made me sigh Pin
Sathesh Sakthivel6-Dec-07 1:49
Sathesh Sakthivel6-Dec-07 1:49 
GeneralRe: This one made me sigh Pin
Russell Jones6-Dec-07 2:51
Russell Jones6-Dec-07 2:51 
GeneralRe: This one made me sigh Pin
Mike Dimmick6-Dec-07 22:59
Mike Dimmick6-Dec-07 22:59 
Unfortunately this is a misfeature of VB.NET that's inherited from VB6. If you declare a Function, but omit the type of the return value, it is implicitly Object (Variant in VB6).

The other misfeature is that in Classic VB, the return value of the function was set by assigning to the name of the function - there was no Return statement. The last value set was the return value, but it didn't return straight away when set. This was very confusing. You could easily forget to set it (in which case it would be defaulted, I think, to the default value for the type, in this case Nothing).

Option Strict fixes many problems in VB code (or, rather, turns them into compile-time errors, forcing you to fix them), and thankfully failing to define the return value of a function is one of them, at least as of VB 7.1 (.NET 2003). You will have to fix all the type-coercion errors if you turn it on, though, using explicit casts. I try to use DirectCast where possible (where I know that the object is already of the type I'm asking it to convert to).





DoEvents: Generating unexpected recursion since 1991


GeneralRe: This one made me sigh Pin
Ri Qen-Sin7-Dec-07 5:10
Ri Qen-Sin7-Dec-07 5:10 
GeneralRe: This one made me sigh Pin
Jeffrey Walton7-Dec-07 22:03
Jeffrey Walton7-Dec-07 22:03 
GeneralRe: This one made me sigh Pin
Paul Conrad8-Dec-07 5:05
professionalPaul Conrad8-Dec-07 5:05 
GeneralThe holy comma operator [modified] Pin
Doc Lobster26-Nov-07 2:47
Doc Lobster26-Nov-07 2:47 
GeneralRe: The holy comma operator Pin
Steve Hansen26-Nov-07 4:36
Steve Hansen26-Nov-07 4:36 
GeneralRe: The holy comma operator Pin
jhwurmbach26-Nov-07 5:20
jhwurmbach26-Nov-07 5:20 
GeneralRe: The holy comma operator Pin
Kastellanos Nikos27-Nov-07 22:40
Kastellanos Nikos27-Nov-07 22:40 
GeneralRe: The holy comma operator Pin
Tony Wesley26-Nov-07 5:26
Tony Wesley26-Nov-07 5:26 
GeneralRe: The holy comma operator Pin
Doc Lobster26-Nov-07 6:35
Doc Lobster26-Nov-07 6:35 
GeneralRe: The holy comma operator Pin
Nemanja Trifunovic26-Nov-07 6:53
Nemanja Trifunovic26-Nov-07 6:53 
GeneralRe: The holy comma operator Pin
Chris Losinger26-Nov-07 7:15
professionalChris Losinger26-Nov-07 7:15 
GeneralRe: The holy comma operator Pin
Michael Dunn27-Nov-07 16:47
sitebuilderMichael Dunn27-Nov-07 16:47 
GeneralRe: The holy comma operator Pin
Anthony Mushrow27-Nov-07 2:38
professionalAnthony Mushrow27-Nov-07 2:38 
GeneralRe: The holy comma operator Pin
Michael Davey 127-Nov-07 12:08
Michael Davey 127-Nov-07 12:08 
GeneralRe: The holy comma operator Pin
Mehmet Suyuti Dindar27-Nov-07 22:50
Mehmet Suyuti Dindar27-Nov-07 22:50 
GeneralRe: The holy comma operator Pin
f228-Nov-07 7:19
f228-Nov-07 7:19 
GeneralRe: The holy comma operator Pin
jschell11-Dec-07 10:03
jschell11-Dec-07 10:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.