Click here to Skip to main content
15,888,454 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: SetFocus to a control that is probably disabled Pin
Dave Kreskowiak10-Oct-07 7:14
mveDave Kreskowiak10-Oct-07 7:14 
GeneralRe: SetFocus to a control that is probably disabled Pin
MarcR.10-Oct-07 7:51
professionalMarcR.10-Oct-07 7:51 
JokeRe: SetFocus to a control that is probably disabled Pin
Big Daddy Farang10-Oct-07 12:53
Big Daddy Farang10-Oct-07 12:53 
GeneralRe: SetFocus to a control that is probably disabled Pin
NormDroid11-Oct-07 4:13
professionalNormDroid11-Oct-07 4:13 
GeneralRe: SetFocus to a control that is probably disabled Pin
Ganesan Sankaran19-Oct-07 1:59
Ganesan Sankaran19-Oct-07 1:59 
GeneralRe: SetFocus to a control that is probably disabled Pin
BrowniePoints22-Oct-07 15:43
BrowniePoints22-Oct-07 15:43 
GeneralSo stingy! Pin
Muammar©7-Oct-07 0:48
Muammar©7-Oct-07 0:48 
GeneralWho needs event handlers... Pin
FyreWyrm5-Oct-07 16:31
FyreWyrm5-Oct-07 16:31 
...do it all in Page_Load!

My company recently purchased a smaller company and our development department took over developing their web applications. My first task was to put a new user control on a few pages in one of the apps. While working on the first page I noticed something a bit odd...

(Sorry for the VB. In my defense, I didn't write the app.)
Private Sub Page_Load(blah, blah) Handles Page.OnLoad

   ' create some objects, initialize some variables

   If Page.IsPostBack
      ' validate the user input
      ValidateInput()
      ' save the user input to the database
      SaveInput()
   End If

End Sub


Farther down in the code I find this...

Private Sub Submit_Click(obj, args) Handles btnSubmit.OnClick

   ' direct the user to the new page
   Response.Redirect(page.aspx)

End Sub


WTF | :WTF:


Smile and the world smiles with you. Laugh and the world thinks your insane.

GeneralRe: Who needs event handlers... Pin
Anton Afanasyev5-Oct-07 22:24
Anton Afanasyev5-Oct-07 22:24 
GeneralRe: Who needs event handlers... Pin
Mustafa Ismail Mustafa10-Oct-07 0:23
Mustafa Ismail Mustafa10-Oct-07 0:23 
GeneralNew basic syntax Pin
bigbrownbeaver5-Oct-07 1:56
bigbrownbeaver5-Oct-07 1:56 
GeneralRe: New basic syntax Pin
PIEBALDconsult5-Oct-07 4:42
mvePIEBALDconsult5-Oct-07 4:42 
GeneralRe: New basic syntax Pin
bigbrownbeaver5-Oct-07 5:05
bigbrownbeaver5-Oct-07 5:05 
GeneralRe: New basic syntax Pin
Luc Pattyn5-Oct-07 5:13
sitebuilderLuc Pattyn5-Oct-07 5:13 
GeneralWhy is my code so slow? Pin
Humble Programmer2-Oct-07 5:01
Humble Programmer2-Oct-07 5:01 
GeneralRe: Why is my code so slow? Pin
Albu Marius2-Oct-07 5:13
Albu Marius2-Oct-07 5:13 
GeneralRe: Why is my code so slow? Pin
jhwurmbach2-Oct-07 6:16
jhwurmbach2-Oct-07 6:16 
GeneralRe: Why is my code so slow? Pin
KarstenK3-Oct-07 20:55
mveKarstenK3-Oct-07 20:55 
GeneralRe: Why is my code so slow? Pin
M@dHatter6-Oct-07 3:55
M@dHatter6-Oct-07 3:55 
JokeRe: Why is my code so slow? Pin
Muammar©7-Oct-07 0:58
Muammar©7-Oct-07 0:58 
GeneralRe: Why is my code so slow? Pin
Dan Neely8-Oct-07 2:25
Dan Neely8-Oct-07 2:25 
GeneralRe: Why is my code so slow? Pin
Joe Programm3r25-Oct-07 6:28
Joe Programm3r25-Oct-07 6:28 
GeneralRe: Why is my code so slow? Pin
Muammar©25-Oct-07 9:29
Muammar©25-Oct-07 9:29 
GeneralGood thing we use a transaction... Pin
GibbleCH27-Sep-07 6:58
GibbleCH27-Sep-07 6:58 
JokeRe: Good thing we use a transaction... Pin
Chris Meech27-Sep-07 7:15
Chris Meech27-Sep-07 7:15 

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.