Source Code for Calculator Project
Public Class Form1
Dim a As Double
Dim b As Double
Dim c As Double
Dim Opt As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
T1.Text += Button1.Text
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
T1.Text += Button2.Text
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
T1.Text += Button4.Text
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
T1.Text += Button3.Text
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
T1.Text += Button6.Text
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
T1.Text += Button5.Text
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
T1.Text += Button10.Text
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
T1.Text += Button9.Text
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
T1.Text += Button8.Text
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
T1.Text += Button7.Text
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub EqualButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EqualButt.Click
b = Val(T1.Text)
If Opt = "/" Then
T1.Text = a / b
ElseIf Opt = "+" Then
T1.Text = a + b
ElseIf Opt = "-" Then
T1.Text = a - b
ElseIf Opt = "*" Then
T1.Text = a * b
ElseIf Opt = "%" Then
T1.Text = a Mod b
End If
End Sub
Private Sub PlusButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlusButt.Click
a = Val(T1.Text)
Opt = PlusButt.Text
T1.Text = ""
End Sub
Private Sub MinusButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MinusButt.Click
a = Val(T1.Text)
T1.Text = ""
Opt = MinusButt.Text
End Sub
Private Sub CEButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CEButt.Click
T1.Text = " "
End Sub
Private Sub CButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CButt.Click
T1.Text = " "
End Sub
Private Sub DivButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DivButt.Click
a = Val(T1.Text)
T1.Text = ""
Opt = DivButt.Text
End Sub
Private Sub DotButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DotButt.Click
T1.Text += DotButt.Text
End Sub
Private Sub ModButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModButt.Click
a = Val(T1.Text)
T1.Text = ""
Opt = ModButt.Text
End Sub
Private Sub StarButt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StarButt.Click
a = Val(T1.Text)
T1.Text = ""
Opt = StarButt.Text
End Sub
End Class