14 Kasım 2013 Perşembe

VB.NET de Hesap Makinesi

vb.net
vb.net
Kodları:

Public Class Form1
    Public degisken As String = ""
    Public sayi1, sayi2 As Integer
    Public durum As Boolean = False
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox1.Text = TextBox1.Text + "1"
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = TextBox1.Text + "2"
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        TextBox1.Text = TextBox1.Text + "3"
    End Sub
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        TextBox1.Text = TextBox1.Text + "4"
    End Sub
    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        TextBox1.Text = TextBox1.Text + "5"
    End Sub
    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        TextBox1.Text = TextBox1.Text + "6"
    End Sub
    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        TextBox1.Text = TextBox1.Text + "7"
    End Sub
    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
        TextBox1.Text = TextBox1.Text + "8"
    End Sub
    Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
        TextBox1.Text = TextBox1.Text + "9"
    End Sub
    Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
        TextBox1.Text = TextBox1.Text + "0"
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub
    Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
        degisken = "+"
        If sayi1 <= 0 Then
            sayi1 = TextBox1.Text
            TextBox1.Text = ""
        Else
            sayi2 = TextBox1.Text
            Button15.Visible = True
            Button11.Visible = False
            Button12.Visible = False
            Button13.Visible = False
            Button14.Visible = False
            TextBox1.Text = ""
        End If
    End Sub
    Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
        degisken = "-"
        If sayi1 < 0 Then
            sayi1 = TextBox1.Text
            TextBox1.Text = ""
        Else
            sayi2 = TextBox1.Text
            Button15.Visible = True
            Button11.Visible = False
            Button12.Visible = False
            Button13.Visible = False
            Button14.Visible = False
            TextBox1.Text = ""
        End If
    End Sub
    Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
        degisken = "*"
        If sayi1 < 0 Then
            sayi1 = TextBox1.Text
            TextBox1.Text = ""
        Else
            sayi2 = TextBox1.Text
            Button15.Visible = True
            Button11.Visible = False
            Button12.Visible = False
            Button13.Visible = False
            Button14.Visible = False
            TextBox1.Text = ""
        End If
    End Sub
    Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
        degisken = "/"
        If sayi1 < 0 Then
            sayi1 = TextBox1.Text
            TextBox1.Text = ""
        Else
            sayi2 = TextBox1.Text
            Button15.Visible = True
            Button11.Visible = False
            Button12.Visible = False
            Button13.Visible = False
            Button14.Visible = False
            TextBox1.Text = ""
        End If
    End Sub
    Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
        If degisken = "+" Then
            TextBox1.Text = sayi1 + sayi2
        ElseIf degisken = "-" Then
            TextBox1.Text = sayi1 - sayi2
        ElseIf degisken = "*" Then
            TextBox1.Text = sayi1 * sayi2
        ElseIf degisken = "/" Then
            TextBox1.Text = sayi1 / sayi2
        End If
        Button11.Visible = True
        Button12.Visible = True
        Button13.Visible = True
        Button14.Visible = True
        Button15.Visible = False
    End Sub
End Class

0 yorum :

Yorum Gönder