Untitled
unknown
plain_text
24 days ago
4.5 kB
3
Indexable
Never
Imports System.Math Public Class Form1 Dim firstnumber As Decimal Dim logic As Integer Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click TextBox1.Text = TextBox1.Text & 0 End Sub Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click TextBox1.Text = TextBox1.Text & (" . ") End Sub Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click Application.Restart() End Sub Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click Me.Close() End Sub -------- (+) Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click If logic = 1 Then firstnumber = Val(firstnumber) + Val(TextBox1.Text) TextBox1.Text = "" logic = 1 ElseIf logic = 2 Then firstnumber = Val(firstnumber) - Val(TextBox1.Text) TextBox1.Text = "" logic = 1 ElseIf logic = 3 Then firstnumber = Val(firstnumber) * Val(TextBox1.Text) TextBox1.Text = "" logic = 1 ElseIf logic = 4 Then firstnumber = Val(firstnumber) / Val(TextBox1.Text) TextBox1.Text = "" logic = 1 Else If TextBox1.Text = "" Then firstnumber = "1" logic = 1 Else firstnumber = TextBox1.Text TextBox1.Text = "" logic = 1 End If End If End Sub -------------- (-) Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click If logic = 1 Then firstnumber = Val(firstnumber) + Val(TextBox1.Text) TextBox1.Text = "" logic = 2 ElseIf logic = 2 Then firstnumber = Val(firstnumber) - Val(TextBox1.Text) TextBox1.Text = "" logic = 2 ElseIf logic = 3 Then firstnumber = Val(firstnumber) * Val(TextBox1.Text) TextBox1.Text = "" logic = 2 ElseIf logic = 4 Then firstnumber = Val(firstnumber) / Val(TextBox1.Text) TextBox1.Text = "" logic = 2 Else If TextBox1.Text = "" Then firstnumber = "1" logic = 2 Else firstnumber = TextBox1.Text TextBox1.Text = "" logic = 2 End If End If End Sub ------- (*) Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click If logic = 1 Then firstnumber = Val(firstnumber) + Val(TextBox1.Text) TextBox1.Text = "" logic = 3 ElseIf logic = 2 Then firstnumber = Val(firstnumber) - Val(TextBox1.Text) TextBox1.Text = "" logic = 3 ElseIf logic = 3 Then firstnumber = Val(firstnumber) * Val(TextBox1.Text) TextBox1.Text = "" logic = 3 ElseIf logic = 4 Then firstnumber = Val(firstnumber) / Val(TextBox1.Text) TextBox1.Text = "" logic = 3 Else If TextBox1.Text = "" Then firstnumber = "1" logic = 3 Else firstnumber = TextBox1.Text TextBox1.Text = "" logic = 3 End If End If End Sub --------- (/) Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click If logic = 1 Then firstnumber = Val(firstnumber) + Val(TextBox1.Text) TextBox1.Text = "" logic = 4 ElseIf logic = 2 Then firstnumber = Val(firstnumber) - Val(TextBox1.Text) TextBox1.Text = "" logic = 4 ElseIf logic = 3 Then firstnumber = Val(firstnumber) * Val(TextBox1.Text) TextBox1.Text = "" logic = 4 ElseIf logic = 4 Then firstnumber = Val(firstnumber) / Val(TextBox1.Text) TextBox1.Text = "" logic = 4 Else If TextBox1.Text = "" Then firstnumber = "1" logic = 4 Else firstnumber = TextBox1.Text TextBox1.Text = "" logic = 4 End If End If End Sub ===== (=) Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click If logic = 1 Then If firstnumber = "1" Then TextBox1.Text = 0 + Val(TextBox1.Text) Else TextBox1.Text = firstnumber + Val(TextBox1.Text) End If ElseIf logic = 2 Then If firstnumber = "1" Then TextBox1.Text = 0 - Val(TextBox1.Text) Else TextBox1.Text = firstnumber - Val(TextBox1.Text) End If ElseIf logic = 3 Then If firstnumber = "1" Then TextBox1.Text = 1 * Val(TextBox1.Text) Else TextBox1.Text = firstnumber * Val(TextBox1.Text) End If Else If TextBox1.Text = 0 Then TextBox1.Text = "Infenity" ElseIf firstnumber = 0 Then TextBox1.Text = "Syntax Error" Else If firstnumber = "1" Then TextBox1.Text = 0 / Val(TextBox1.Text) Else TextBox1.Text = firstnumber / Val(TextBox1.Text) End If End If End If End Sub
Leave a Comment