Public Class Form1
    Dim kq As Double
    Dim b As Double
    Dim a As Double

    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        a = CDbl(TextBox1.Text)
    End Sub
    Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
        b = CDbl(TextBox2.Text)
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        kq = a + b
        TextBox3.Text = CStr(kq)
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        kq = a - b
        TextBox3.Text = CStr(kq)
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        kq = a * b
        TextBox3.Text = CStr(kq)
    End Sub
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        If b = 0 Then
            TextBox3.Text = CStr("error")
        Else
            kq = a / b
            TextBox3.Text = CStr(kq)
        End If
    End Sub
End Class
