First we create a form and we throw and edit 2 textboxes, 1 label, 4 buttons inside. We put +, -, x, / signs in the text properties of the buttons.
We double click on the "+" button and click the
Dim sayi1, sayi2 As Integer sayi1 = TextBox1.Text sayi2 = TextBox2.Text Label1.Text = sayi1 + sayi2
We double click on the "-" button and click the
Label1.Text = TextBox1.Text - TextBox2.Text
We double click on the "x" button and click the
Label1.Text = TextBox1.Text * TextBox2.Text
We double click on the "/" button and click the
Label1.Text = TextBox1.Text / TextBox2.Text
the final version of our code
Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim sayi1, sayi2 As Integer sayi1 = TextBox1.Text sayi2 = TextBox2.Text Label1.Text = sayi1 + sayi2 End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Label1.Text = TextBox1.Text - TextBox2.Text End Sub Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click Label1.Text = TextBox1.Text * TextBox2.Text End Sub Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click Label1.Text = TextBox1.Text / TextBox2.Text End Sub End Class
click to download
Tagged In:
Visual Basic