Dims
******
Dim Firstnum As Decimal
Dim secondnum As Decimal
Dim Operations As Integer
Dim Operator_selctor As Boolean = False
****************************************************************************************************************************************************
Num 1
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "1"
Else
TextBox1.Text = "1"
End If
End Sub
****************************************************************************************************************************************************
Num 2
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "2"
Else
TextBox1.Text = "2"
End If
End Sub
****************************************************************************************************************************************************
Num 3
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "3"
Else
TextBox1.Text = "3"
End If
End Sub
****************************************************************************************************************************************************
Num 4
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "4"
Else
TextBox1.Text = "4"
End If
End Sub
****************************************************************************************************************************************************
Num 5
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "5"
Else
TextBox1.Text = "5"
End If
End Sub
****************************************************************************************************************************************************
Num 6
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "6"
Else
TextBox1.Text = "6"
End If
End Sub
****************************************************************************************************************************************************
Num 7
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "7"
Else
TextBox1.Text = "7"
End If
End Sub
****************************************************************************************************************************************************
Num 8
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "8"
Else
TextBox1.Text = "8"
End If
End Sub
****************************************************************************************************************************************************
Num 9
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "9"
Else
TextBox1.Text = "9"
End If
End Sub
****************************************************************************************************************************************************
Num 0
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "0"
End If
End Sub
****************************************************************************************************************************************************
Clear Button
**************
TextBox1.Text = "0"
End Sub
****************************************************************************************************************************************************
(.) Button
***********
If Not (TextBox1.Text.Contains(".")) Then
TextBox1.Text += "."
End If
End Sub
****************************************************************************************************************************************************
(+) Button
***********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 1 ' = +
End Sub
****************************************************************************************************************************************************
(-) Button
**********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 2 ' - -
End Sub
****************************************************************************************************************************************************
(x) Button
***********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 3 '=x
End Sub
****************************************************************************************************************************************************
(/) Button
**********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 4 ' /
End Sub
****************************************************************************************************************************************************
(=) Button
***********
If Operator_selctor = True Then
secondnum = TextBox1.Text
If Operations = 1 Then
TextBox1.Text = Firstnum + secondnum
ElseIf Operations = 2 Then
TextBox1.Text = Firstnum - secondnum
ElseIf Operations = 3 Then
TextBox1.Text = Firstnum * secondnum
Else
If secondnum = 0 Then
TextBox1.Text = "Error!"
Else
TextBox1.Text = Firstnum / secondnum
End If
End If
Operator_selctor = False
End If
End Sub
End Class
****************************************************************************************************************************************************
0 comments:
Post a Comment