title: Arithmetical Exceptions
body: <p>I'm in a programming high school course, and my assignment is to write a program that uses: OverflowException, or NotFiniteNumberException. It has to be arithmetical and I've tried everything I can think of, but I can't seem to get it to print correctly so I'm assuming the problem is with my code. This is one of the things I've tried:</p>
  
  <p>Module Module1</p>
  
  <pre><code>Sub Main()
      Dim A As Integer = Integer.MaxValue
      Dim B As Integer = A + 1
      Try
          Console.WriteLine("The answer is: ", B)
          Console.ReadLine()
      Catch C As OverflowException
          Console.WriteLine("B is greater than the maximum value ")
          Console.ReadLine()
      End Try
  End Sub
  </code></pre>
  
  <p>End Module</p>
  
  <p>When I do this, it <em>does</em> give an error message, but it says "Unhandled Exception", and not "B is greater than the maximum value". Obviously, I don't know why it does this, so any information would be a big help. If it would be easier to suggest a way to write one with NotFiniteNumberException that would work also, I just thought I'd show what I've tried, thanks!</p>