Example 1:
First insert 4 LABELS, 4 TEXT BOXES, 4 BUTTONS.
This is the FORM design.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 + number2
TextBox1.Text = answer
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 - number2
TextBox2.Text = answer
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 * number2
TextBox3.Text = answer
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 / number2
TextBox4.Text = answer
End Sub
End Class
Then click on the buttons the result is:
First insert 4 LABELS, 4 TEXT BOXES, 4 BUTTONS.
This is the FORM design.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 + number2
TextBox1.Text = answer
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 - number2
TextBox2.Text = answer
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 * number2
TextBox3.Text = answer
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim number1 As Integer = 100
Dim number2 As Integer = 50
Dim answer As Integer
answer = number1 / number2
TextBox4.Text = answer
End Sub
End Class
Then RUN the FORM.
we get the result as:
Then click on the buttons the result is:
VB.NET HOME PAGE
No comments:
Post a Comment