Dim num1, num2, sum As Double
    num1 = txtFirstNum.Text                             A variable input any number can go here
    num2 = txtSecondNum.Text                            A variable input any number can go here
    sum = num1 + num2
    txtoutput.Text = sum

My goal is to have the txtoutput show the equation 2 + 2 = 4
not just the sum 4

I have two input textboxes to enter the integers, a button to add them, and an output txtbox for the solution. Instead of just the sum I need to show the eqaution.

Please help. I am new and trying to learn.

Edited 4 Years Ago by charles.coogan: Grammer

You have to convert the strings to their integer equivalents with CInt as in

num1 = CInt(txtFirstNum.Text)

But you should first check that the string is a valid number by

If IsNumeric(txtFirstNum.Text) Then
    num1 = CInt(txtFirstNum.Text)
Else
    MsgBox("First Number (" & txtFirstNum.Text & ") is not a number")
End If

we are not doing if statements. All I need is the last line to convert the solution into a string that displays both inputs along with an = sign and the answer. Go basic.

txtoutput.Text = txtFirstNum.Text  & " + " & _
                 txtSecondNum.Text & " = " & _
                 (CInt(txtFirstNum.Text) + CInt(txtSecondNum.Text)).ToString

Edited 4 Years Ago by Reverend Jim

This question has already been answered. Start a new discussion instead.