12 Ocak 2014 Pazar
HESAP MAKİNASI ÖRNEK KODLARI
HESAP MAKİNASI KODLARI
İNDİR
Public Class HMFrm Dim Bellek As Decimal Dim islem As String Dim Hesaplanan As Boolean = False Private Sub Btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn0.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("0") Else txtEkran.AppendText("0") End If End Sub Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("1") Else txtEkran.AppendText("1") End If End Sub Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("2") Else txtEkran.AppendText("2") End If End Sub Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("3") Else txtEkran.AppendText("3") End If End Sub Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("4") Else txtEkran.AppendText("4") End If End Sub Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("5") Else txtEkran.AppendText("5") End If End Sub Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("6") Else txtEkran.AppendText("6") End If End Sub Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("7") Else txtEkran.AppendText("7") End If End Sub Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("8") Else txtEkran.AppendText("8") End If End Sub Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click If Hesaplanan Then Hesaplanan = False txtEkran.Clear() txtEkran.AppendText("9") Else txtEkran.AppendText("9") End If End Sub Private Sub btnNokta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNokta.Click If txtEkran.Text.Contains(".") Then Exit Sub Else txtEkran.AppendText(".") End If End Sub Private Sub btnIsaret_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsaret.Click Dim TxtDegeri As Decimal If Decimal.TryParse(txtEkran.Text, TxtDegeri) Then If Math.Sign(TxtDegeri) = "-1" Then txtEkran.Text = Math.Abs(TxtDegeri) Else txtEkran.Text = -txtEkran.Text End If End If End Sub Private Sub btnArti_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnArti.Click If Decimal.TryParse(txtEkran.Text, Nothing) Then Bellek = txtEkran.Text islem = "+" txtEkran.Text = Nothing lblIslem.Text = Bellek.ToString & " " & islem End If End Sub Private Sub btnEksi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEksi.Click If Decimal.TryParse(txtEkran.Text, Nothing) Then Bellek = txtEkran.Text islem = "-" txtEkran.Text = Nothing lblIslem.Text = Bellek.ToString & " " & islem End If End Sub Private Sub btnCarpi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCarpi.Click If Decimal.TryParse(txtEkran.Text, Nothing) Then Bellek = txtEkran.Text islem = "*" txtEkran.Text = Nothing lblIslem.Text = Bellek.ToString & " " & islem End If End Sub Private Sub btnBolu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBolu.Click If Decimal.TryParse(txtEkran.Text, Nothing) Then Bellek = txtEkran.Text islem = "/" txtEkran.Text = Nothing lblIslem.Text = Bellek.ToString & " " & islem End If End Sub Private Sub btnKarekok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKarekok.Click If Decimal.TryParse(txtEkran.Text, Nothing) Then txtEkran.Text = (Math.Sqrt(txtEkran.Text)) Hesaplanan = True End If End Sub Private Sub btnEsit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEsit.Click If Bellek = Nothing OrElse txtEkran.Text = Nothing OrElse txtEkran.Text = "" Then Exit Sub Select Case islem Case "*" txtEkran.Text = Bellek * txtEkran.Text Case "/" txtEkran.Text = Bellek / txtEkran.Text Case "-" txtEkran.Text = Bellek - txtEkran.Text Case "+" txtEkran.Text = Bellek + txtEkran.Text End Select Hesaplanan = True End Sub Private Sub btnKarsilik_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKarsilik.Click If Decimal.TryParse(txtEkran.Text, vbNullString) Then txtEkran.Text = 1 / (CDec(txtEkran.Text)) Hesaplanan = True End If End Sub Private Sub btnInt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInt.Click On Error Resume Next txtEkran.Text = Math.Round(CDec(txtEkran.Text), MidpointRounding.AwayFromZero) Hesaplanan = True End Sub Private Sub btnGeriAl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGeriAl.Click If txtEkran.TextLength = 0 Then Exit Sub Else txtEkran.Text = txtEkran.Text.Remove(txtEkran.TextLength - 1) End If End Sub Private Sub btnSil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSil.Click txtEkran.Text = Nothing Bellek = Nothing lblIslem.Text = Nothing End Sub End Class
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa