This commit is contained in:
RayskayaA 2025-12-10 06:47:52 +00:00
parent f9cb9fed82
commit b96ed2b859

137
Form1.vb
View File

@ -1,64 +1,149 @@
Public Class Form1 Imports System.DirectoryServices
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click Imports System.Security.Cryptography.X509Certificates
Public Class Form1
Dim a As Double
Dim b As Double
Dim result As Double
Dim memory As Double = 0
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
End Sub End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TextBox1.Text = "" TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1)
Label2.Text = ""
End Sub End Sub
Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click Private Sub Button5_Click(sender As Object, e As EventArgs) Handles num1.Click
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
TextBox1.Text = TextBox1.Text + "1" TextBox1.Text = TextBox1.Text + "1"
End Sub End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click Private Sub Button6_Click(sender As Object, e As EventArgs) Handles num2.Click
TextBox1.Text = TextBox1.Text + "2" TextBox1.Text = TextBox1.Text + "2"
End Sub End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click Private Sub Button7_Click(sender As Object, e As EventArgs) Handles num3.Click
TextBox1.Text = TextBox1.Text + "3" TextBox1.Text = TextBox1.Text + "3"
End Sub End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click Private Sub Button9_Click(sender As Object, e As EventArgs) Handles num4.Click
TextBox1.Text = TextBox1.Text + "4" TextBox1.Text = TextBox1.Text + "4"
End Sub End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click Private Sub Button10_Click(sender As Object, e As EventArgs) Handles num5.Click
TextBox1.Text = TextBox1.Text + "5" TextBox1.Text = TextBox1.Text + "5"
End Sub End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click Private Sub Button11_Click(sender As Object, e As EventArgs) Handles num6.Click
TextBox1.Text = TextBox1.Text + "6" TextBox1.Text = TextBox1.Text + "6"
End Sub End Sub
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click Private Sub Button17_Click(sender As Object, e As EventArgs) Handles num7.Click
TextBox1.Text = TextBox1.Text + "7" TextBox1.Text = TextBox1.Text + "7"
End Sub End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click Private Sub Button18_Click(sender As Object, e As EventArgs) Handles num8.Click
TextBox1.Text = TextBox1.Text + "8" TextBox1.Text = TextBox1.Text + "8"
End Sub End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click Private Sub Button19_Click(sender As Object, e As EventArgs) Handles num9.Click
TextBox1.Text = TextBox1.Text + "9" TextBox1.Text = TextBox1.Text + "9"
End Sub End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Private Sub Button14_Click(sender As Object, e As EventArgs) Handles num0.Click
TextBox1.Text = "" TextBox1.Text = TextBox1.Text + "0"
Label2.Text = ""
Label1.Text = ""
End Sub End Sub
Private Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.Click Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Delenie.Click
If Label2.Text = "+" Then TextBox1.Text = TextBox1.Text + "/"
TextBox1.Text = Val(Label1.Text) + Val(TextBox1.Text) End Sub
Label1.Text = ""
Label2.Text = "+" Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Multiply.Click
TextBox1.Text = TextBox1.Text + "*"
End Sub
Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Minus.Click
TextBox1.Text = TextBox1.Text + "-"
End Sub
Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Plus.Click
TextBox1.Text = TextBox1.Text + "+"
End Sub
Private Sub Button24_Click(sender As Object, e As EventArgs) Handles Ravno.Click
Dim text As String = TextBox1.Text
If text.Contains("+") Then
Dim parts() As String = text.Split("+")
TextBox2.Text = (Val(parts(0))) + Val(parts(1)).ToString()
ElseIf text.Contains("-") Then
Dim parts() As String = text.Split("-")
TextBox2.Text = (Val(parts(0))) - Val(parts(1)).ToString()
ElseIf text.Contains("/") Then
Dim parts() As String = text.Split("/")
If Val(parts(1)) <> 0 Then
TextBox2.Text = (Val(parts(0))) / Val(parts(1)).ToString()
Else
TextBox2.Text = "Делить на ноль нельзя!"
End If
ElseIf text.Contains("*") Then
Dim parts() As String = text.Split("*")
TextBox2.Text = (Val(parts(0))) * Val(parts(1)).ToString()
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
TextBox1.Clear()
TextBox2.Clear()
End Sub
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
If TextBox1.Text <> "" Then
Dim number As Integer = CInt(TextBox1.Text)
Dim remainder As Integer = number Mod 2
TextBox2.Text = remainder.ToString()
End If
End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
Dim s As String = TextBox1.Text
If s = "" Or s = "-" Then
TextBox1.Text = "-"
ElseIf s.StartsWith("-") Then
TextBox1.Text = s.Substring(1)
Else
TextBox1.Text = "-" & s
End If
End Sub
Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
If memory <> 0 Then
TextBox1.Text = memory.ToString()
Else
TextBox1.Text = ("Память пуста!")
End If
End Sub
Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
Try
Dim value As Double
If TextBox2.Text <> "" AndAlso TextBox2.Text <> "0" Then
value = Val(TextBox2.Text)
Else
TextBox1.Text = ("Нет значения для добавления в память")
Return
End If
memory += value
Catch ex As Exception
MessageBox.Show("Ошибка")
End Try
End Sub
Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
If memory <> 0 Then
TextBox1.Text = ("Память очищена")
memory = 0
Else
TextBox1.Text = ("Память уже пуста!")
End If End If
End Sub End Sub
End Class End Class