So, my instructor gave me 100/100 on the first two assignments - hello world and some other bizarre application that displays different text depending on which radiobutton and checkbox you pick. For my last four projects, I have taken considerable liberty with my programming. I've introduced things that aren't in the scope of the class ... things like GDI printing, structs, enums and <gasp> even data driven error control.
I find it to be laziness when programmers users rely on Try/Catch blocks to prevent invalid data from being entered.
The textbook says to use a Try/Catch block to prevent a user from entering text in a numeric textbox. I prefer to simply find out if the text is numeric before I try to act on it ...
Why would I use
Try
ThisVar = Cint(TextBox1.Text)
Catch ex As Exception
MsgBox(e.Message)
End Try
When this will give a better result and allow you to filter stuff as you go.
If IsNumeric(TextBox1.Text) Then
ThisVar = Cint(TextBox1.Text)
Else
MsgBox("TextBox1 can contain only numbers")
End If
Maybe it is just me, but I hate like hell seeing those errors line up in the immediate window ..
Heck, I even use Option Strict and treat all warnings as errors ... in the end, the code is much more stable.
Oh well, such is life.