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.

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

Great that is what I needed thank you!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.