'Program: Week8Test40 'Author: Allen Benusa 'Date : March 4th, 2006 ' 'This demonstration checks the input to be sure it is numeric. 'Also it catches divide by zero errors. Option Explicit On Option Strict On Public Class Form1 Inherits System.Windows.Forms.Form - snip - Private Sub cmdCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCompute.Click Dim a, b As Integer Dim result As Double 'A person could also do IsNumeric check such as the following 'If IsNumeric(a) And IsNumeric(b) Then Try a = CInt(txtInput1.Text) b = CInt(txtInput2.Text) result = a / b lblOutput.Text = CStr(result) Catch exceptObj As DivideByZeroException MessageBox.Show(exceptObj.Message) Catch exceptObj As InvalidCastException MessageBox.Show(exceptObj.Message) End Try End Sub End Class