Vb.Net Dersleri – Hesap Makinesi Yapımı

Vb.net ile hesap makinesi uygulamasını yapabilmek için ilk olarak aşağıdaki form görünümü oluşturuyoruz. Form üzerine 20 buton 1 TextBox ekliyoruz. Vb.net Hesap Makinesi uygulamasının çalışan halini konu sonundan indirebilirsiniz.
vbnethesapmakinesi

Dim sayi1 As Double
Dim sayi2 As Double
Dim sonuc As Double
Dim islec As String
Private Sub cmd8_Click(sender As System.Object, e As System.EventArgs) Handles cmd8.Click
TextBox1.Text = TextBox1.Text & "8"
End Sub
Private Sub cmd9_Click(sender As System.Object, e As System.EventArgs) Handles cmd9.Click
TextBox1.Text = TextBox1.Text & "9"
End Sub
Private Sub cmd4_Click(sender As System.Object, e As System.EventArgs) Handles cmd4.Click
TextBox1.Text = TextBox1.Text & "4"
End Sub
'www.bilisimogretmeni.com
Private Sub cmd5_Click(sender As System.Object, e As System.EventArgs) Handles cmd5.Click
TextBox1.Text = TextBox1.Text & "5"
End Sub
Private Sub cmd6_Click(sender As System.Object, e As System.EventArgs) Handles cmd6.Click
TextBox1.Text = TextBox1.Text & "6"
End Sub
Private Sub cmd7_Click(sender As System.Object, e As System.EventArgs) Handles cmd7.Click
TextBox1.Text = TextBox1.Text & "7"
End Sub
'www.bilisimogretmeni.com
Private Sub cmd0_Click(sender As System.Object, e As System.EventArgs) Handles cmd0.Click
TextBox1.Text = TextBox1.Text & "0"
End Sub
Private Sub cmd1_Click(sender As System.Object, e As System.EventArgs) Handles cmd1.Click
TextBox1.Text = TextBox1.Text & "1"
End Sub
Private Sub cmd2_Click(sender As System.Object, e As System.EventArgs) Handles cmd2.Click
TextBox1.Text = TextBox1.Text & "2"
End Sub
Private Sub cmd3_Click(sender As System.Object, e As System.EventArgs) Handles cmd3.Click
TextBox1.Text = TextBox1.Text & "3"
End Sub
Private Sub cmdNokta_Click(sender As System.Object, e As System.EventArgs) Handles cmdNokta.Click
TextBox1.Text = TextBox1.Text & "."
End Sub
Private Sub cmdCE_Click(sender As System.Object, e As System.EventArgs) Handles cmdCE.Click
TextBox1.Clear() 'textbox1.text=""
End Sub
Private Sub cmdEsit_Click(sender As System.Object, e As System.EventArgs) Handles cmdEsit.Click
sayi2 = Val(TextBox1.Text)
Select Case islec
Case "+" : sonuc = sayi1 + sayi2
Case "-" : sonuc = sayi1 - sayi2
Case "*" : sonuc = sayi1 * sayi2
Case "/" : sonuc = sayi1 / sayi2
Case "^" : sonuc = sayi1 ^ sayi2
End Select
TextBox1.Text = sonuc
End Sub
Private Sub cmdTopla_Click(sender As System.Object, e As System.EventArgs) Handles cmdTopla.Click
sayi1 = Convert.ToDouble(TextBox1.Text)
TextBox1.Clear()
islec = "+"
End Sub
'www.bilisimogretmeni.com
Private Sub cmdCikar_Click(sender As System.Object, e As System.EventArgs) Handles cmdCikar.Click
sayi1 = Convert.ToDouble(TextBox1.Text)
TextBox1.Clear()
islec = "-"
End Sub
Private Sub cmdCarp_Click(sender As System.Object, e As System.EventArgs) Handles cmdCarp.Click
sayi1 = Convert.ToDouble(TextBox1.Text)
TextBox1.Clear()
islec = "*"
End Sub
Private Sub cmdBol_Click(sender As System.Object, e As System.EventArgs) Handles cmdBol.Click
sayi1 = Convert.ToDouble(TextBox1.Text)
TextBox1.Clear()
islec = "/"
End Sub
Private Sub cmdUs_Click(sender As System.Object, e As System.EventArgs) Handles cmdUs.Click
sayi1 = Convert.ToDouble(TextBox1.Text)
TextBox1.Clear()
islec = "^"
End Sub
Private Sub cmdYuzde_Click(sender As System.Object, e As System.EventArgs) Handles cmdYuzde.Click
TextBox1.Text = Val(TextBox1.Text) / 100
End Sub
'www.bilisimogretmeni.com
Private Sub cmdKok_Click(sender As System.Object, e As System.EventArgs) Handles cmdKok.Click
TextBox1.Text = Math.Sqrt(TextBox1.Text)
End Sub

Vb.Net Hesap Makinesi Uygulaması (790 indirme) İndir

Pin It on Pinterest