title: VB.Net Code comparision - which one is better and why?
body: <p>it's my first post. 
  Could you give me some tips which code is better and why?
  Mainly those two codes do the same, but using other methods.
  Cheers</p>
  
  <p><strong>FIRST CODE</strong></p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Age.Click
      Dim age As Integer
      Dim boxinput As String
  
      boxinput = InputBox("Please input your age", "Age input", "28")
  
      Try
          age = boxinput
  
  
      Catch ex As Exception
          If boxinput = "" Then
              MessageBox.Show("You clicked cancel!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
  
              Exit Sub
          Else
              MessageBox.Show("Correct your age!" &amp; Environment.NewLine &amp; "Input number only!")
          End If
  
      End Try
  
  End Sub
  </code></pre>
  
  <p><strong><em>SECOND CODE</em></strong></p>
  
  <pre><code>Private Sub Age2_Click(sender As Object, e As EventArgs) Handles Age2.Click
      Dim age As Integer
      Dim boxinput As String
  
      boxinput = InputBox("Please input your age", "Age input", "28")
  
      If boxinput = "" Then
          MessageBox.Show("You clicked cancel!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
          Exit Sub
      ElseIf IsNumeric(boxinput) Then
          age = CInt(boxinput)
      Else
          MessageBox.Show("Correct your age!" &amp; Environment.NewLine &amp; "Input number only!")
      End If
  
  End Sub
  </code></pre>