Taken from C# 205 Lesson 8 Using Classes Part 2:MathSolver I created a custom class and use it in the form Private Sub btnGO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGO.Click '---define and initialize Dim firstNumber As Integer = 0 Dim secondNumber As Integer = 0 Dim myResult As Integer = 0 firstNumber = CInt(txtFirst.Text) secondNumber = CInt(txtSecond.Text) Dim getAnswer As New DoMath 'create object from our new class myResult = getAnswer.Compute(firstNumber, secondNumber, myOperand) 'pass numbers and compute txtAnswer.Text = myResult.ToString 'convert to string and display End Sub Created 8/8/06 for C# 2005 'This class has one method that computes the answer sent to it. The method accepts 3 parameters: 'the first number, second number, the operation (+,-,*,/) and returns an integer as the answer. Public Class DoMath ''' ''' This method accepts two integers and the operand (+,-,*,/) and returns the answer as an integer. ''' Public Function Compute(ByVal x As Integer, ByVal y As Integer, ByVal z As String) As Integer Dim theResult As Integer Select Case z Case "+" theResult = x + y Case "-" theResult = x - y Case "*" theResult = x * y Case "/" theResult = x / y End Select Return theResult End Function End Class