150 lines
5.3 KiB
VB.net
150 lines
5.3 KiB
VB.net
Imports System.DirectoryServices
|
|
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
|
|
|
|
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
|
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1)
|
|
End Sub
|
|
|
|
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles num1.Click
|
|
TextBox1.Text = TextBox1.Text + "1"
|
|
End Sub
|
|
|
|
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles num2.Click
|
|
TextBox1.Text = TextBox1.Text + "2"
|
|
End Sub
|
|
|
|
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles num3.Click
|
|
TextBox1.Text = TextBox1.Text + "3"
|
|
End Sub
|
|
|
|
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles num4.Click
|
|
TextBox1.Text = TextBox1.Text + "4"
|
|
End Sub
|
|
|
|
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles num5.Click
|
|
TextBox1.Text = TextBox1.Text + "5"
|
|
End Sub
|
|
|
|
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles num6.Click
|
|
TextBox1.Text = TextBox1.Text + "6"
|
|
End Sub
|
|
|
|
Private Sub Button17_Click(sender As Object, e As EventArgs) Handles num7.Click
|
|
TextBox1.Text = TextBox1.Text + "7"
|
|
End Sub
|
|
|
|
Private Sub Button18_Click(sender As Object, e As EventArgs) Handles num8.Click
|
|
TextBox1.Text = TextBox1.Text + "8"
|
|
End Sub
|
|
|
|
Private Sub Button19_Click(sender As Object, e As EventArgs) Handles num9.Click
|
|
TextBox1.Text = TextBox1.Text + "9"
|
|
End Sub
|
|
|
|
Private Sub Button14_Click(sender As Object, e As EventArgs) Handles num0.Click
|
|
TextBox1.Text = TextBox1.Text + "0"
|
|
End Sub
|
|
|
|
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Delenie.Click
|
|
TextBox1.Text = TextBox1.Text + "/"
|
|
End Sub
|
|
|
|
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 Sub
|
|
End Class
|