Visual Basic
Write a simple program in Visual basic to make addition and subtraction for two integer numbers
Public Class Form1
Dim a As Integer // define variable a to hold number
Dim b As Integer
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles
btnAdd.Click
a = txt1st.Text // convert text value to variable a
b = txt2nd.Text // convert text value to variable b
txtResult.Text = Val(a) + Val(b) // display addition in text
result
End Sub
Private Sub btnSub_Click(sender As Object, e As EventArgs)
Handles btnSub.Click
a = txt1st.Text
b = txt2nd.Text
txtResult.Text = Val(a) - Val(b) // subtraction result
End Sub
End Class
Thanks if you have any query you can ask me in comment section below.
Get Answers For Free
Most questions answered within 1 hours.