Please let other users know how useful this tip is by rating it below. Do you have a tip or code of your own you'd like to share? Submit it here.
The "Protected WithEvents" lines within Form.aspx.vb frequently contain references to defunct controls on Form.aspx. The quickest way to remove these is simply to delete all the "Protected WithEvents" lines, save, and then switch to the design view and click on a control. The "Protected WithEvents" lines in Form.aspx.vb will then be re-populated with only the current controls.
In an extreme case (where a form had been created by copying an existing one), so much dead code was subsequently identified that an 800 line code behind file was reduced to less than 200 lines.