Design without codes |
Design after adding codes |
Final design |
* 17 Buttons
* 3 Textbox
Button Layout:
Button1 = 1 Button10 = 0
Button2 = 2 Button11 = +
Button3 = 3 Button12 = -
Button4 = 4 Button13 = x
Button5 = 5 Button14 = /
Button6 = 6 Button15 = Clear
Button7 = 7 Button16 = "="
Button8 = 8 Button17 = --->
Button9 = 9
The following is the codes for this program
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = TextBox1.Text + "1"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = TextBox1.Text + "1"
End Sub
TextBox1.Text = TextBox1.Text + "2"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = TextBox1.Text + "3"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.Text = TextBox1.Text + "4"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text = TextBox1.Text + "5"
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
TextBox1.Text = TextBox1.Text + "6"
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text = TextBox1.Text + "7"
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
TextBox1.Text = TextBox1.Text + "8"
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
TextBox1.Text = TextBox1.Text + "9"
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
TextBox1.Text = TextBox1.Text + "0"
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
TextBox2.Text = TextBox1.Text
TextBox3.Text = "+"
TextBox1.Text = ""
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
If TextBox3.Text = "+" Then
TextBox3.Text = TextBox1.Text
TextBox1.Text = Val(TextBox2.Text) + Val(TextBox3.Text)
End If
If TextBox3.Text = "x" Then
TextBox3.Text = TextBox1.Text
TextBox1.Text = Val(TextBox2.Text) * Val(TextBox3.Text)
End If
If TextBox3.Text = "/" Then
TextBox3.Text = TextBox1.Text
TextBox1.Text = Val(TextBox2.Text) / Val(TextBox3.Text)
End If
If TextBox3.Text = "-" Then
TextBox3.Text = TextBox1.Text
TextBox1.Text = Val(TextBox2.Text) / Val(TextBox3.Text)
End If
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
TextBox2.Text = TextBox1.Text
TextBox3.Text = "x"
TextBox1.Text = ""
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
TextBox2.Text = TextBox1.Text
TextBox3.Text = "/"
TextBox1.Text = ""
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
TextBox1.Text = ""
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
TextBox2.Text = TextBox1.Text
TextBox3.Text = "-"
TextBox1.Text = ""
End Sub
End Class
Project and Source File Download
No comments:
Post a Comment