67Views2Replies

Author Options:

i need help with this code trying to make a basic calculator with two inputs and one output with VB2008 (Express)? Answered

my code is
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim number1, number2, sum
        number1 = TextBox1.Text
        number2 = TextBox2.Text
        sum = number1 + number2
        MessageBox.show("the sum of" & number1.ToString() & " and " &number2.ToString() & " equals " & sum.ToString() &)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim number1, number2, sum
        number1 = TextBox1.Text
        number2 = TextBox2.Text
        sum = number1 - number2
        MessageBox.show("the sum of" & number1.ToString() & " and " &number2.ToString() & " equals " & sum.ToString() &)
    End Sub
End Class

Could any one tell me what is wrong with the brackets at the end of "Messagebox" the lines?
im just guessing its an easy fix

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.
0
NachoMahma
NachoMahma

10 years ago

.  I'd try deleting the last ampersands on each line as they have no second "argument."