title: Why doesn't Try/Catch work within number types?
body: <pre><code>Dim mynumber as Integer 'This is the variable as an integer, (Integers only allow WHOLE numbers)
  
  Console.WriteLine("Enter your number..") 'Ask to enter number
      Try
          mynumber = Console.ReadLine 'Read user input and store it
      Catch
          Console.WriteLine()
          Console.ForegroundColor = ConsoleColor.Red
          Console.WriteLine("Only whole numbers allowed! Press enter to start again!")
          Console.ResetColor()
          Console.ReadLine()
          Console.Clear()
          GoTo start
      End Try
  </code></pre>
  
  <p>Okay guys, As you can see from the example above I have set up a a Try/Catch for error handling. I have come across a problem. YES the Try/Catch code prevents letters (strings) from being entered in but when I enter a decimal number it still accepts it. Why? And How can this be prevented? A decimal number is not meant to be accepted because an integer only accepts whole numbers!</p>
  
  <p>Thanks.</p>