Bilgisayar dersinde yaptığımız hesap makinesini kodlarını ve Vb dosyalarını paylaşıyorum.İşinize yarayabilir belki..
2 form'dan oluşmaktadır.2 formun kodlarıda aşağıda , ayrıetten dosyada form 2'e ulaşmak için istatistiksel hesaplamalar.vb adında dosya mevcuttur.
Form1
Public Class Form1
Dim a, b, hafiza As Decimal
Dim islem As Char
Dim durum, durum2, sayi As Boolean
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button11.Click, Button12.Click, Button13.Click, Button16.Click, Button17.Click, Button18.Click
If durum = True Then
a = CDec(TextBox1.Text)
TextBox1.Text = sender.text
durum = False
durum2 = True
Else
TextBox1.Text = TextBox1.Text + sender.text
End If
sayi = True
End Sub
Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
a = 0
b = 0
TextBox1.Text = 0
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = "/"
durum = True
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = "*"
durum = True
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = "+"
durum = True
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = "-"
durum = True
End Sub
Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
On Error Resume Next
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1)
End Sub
Private Sub Button37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button37.Click
TextBox1.Text = Math.Sqrt(TextBox1.Text)
End Sub
Private Sub Button34_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button34.Click
TextBox1.Text = Math.Log10(TextBox1.Text)
durum = True
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If sayi = True Then
TextBox1.Text = CDec(TextBox1.Text)
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
sayi = False
If TextBox1.Text.IndexOf(",") = -1 Then
TextBox1.Text = TextBox1.Text + ","
Else
Exit Sub
End If
End Sub
Private Sub Button29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button29.Click
TextBox1.Text = Math.Sin(Math.PI * TextBox1.Text / 180)
End Sub
Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button28.Click
TextBox1.Text = Math.Cos(Math.PI * TextBox1.Text / 180)
End Sub
Private Sub Button33_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button33.Click
TextBox1.Text = Math.Log(TextBox1.Text)
End Sub
Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click
If Math.Cos(Math.PI * TextBox1.Text / 180) <> 0 Then
TextBox1.Text = Math.Sin(Math.PI * TextBox1.Text / 180) / Math.Cos(Math.PI * TextBox1.Text / 180)
Else
Exit Sub
End If
End Sub
Private Sub Button36_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button36.Click
TextBox1.Text = TextBox1.Text * TextBox1.Text
End Sub
Private Sub Button39_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
TextBox1.Text = TextBox1.Text * TextBox1.Text * TextBox1.Text
End Sub
Private Sub Button32_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button32.Click
TextBox1.Text = -1 * TextBox1.Text
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = ""
durum2 = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
hafiza = TextBox1.Text
End Sub
Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click
TextBox1.Text = Val(TextBox1.Text) + hafiza
End Sub
Private Sub Button35_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button35.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = "^"
durum = True
End Sub
Private Sub Button42_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button42.Click
TextBox1.Text = 1 / TextBox1.Text
End Sub
Private Sub Button30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button30.Click
If Math.Sin(Math.PI * TextBox1.Text / 180) <> 0 Then
TextBox1.Text = Math.Cos(Math.PI * TextBox1.Text / 180) / Math.Sin(Math.PI * TextBox1.Text / 180)
Else
Exit Sub
End If
End Sub
Private Sub Button44_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button44.Click
TextBox1.Text = 0
End Sub
Private Sub Button46_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button46.Click
hafiza = "0"
Label1.Text = " "
End Sub
Private Sub Button45_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button45.Click
TextBox1.Text = hafiza
End Sub
Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click
TextBox1.Text = Math.Sinh(TextBox1.Text)
End Sub
Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click
TextBox1.Text = Math.Cosh(TextBox1.Text)
End Sub
Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click
TextBox1.Text = Math.Tanh(TextBox1.Text)
End Sub
Private Sub Button41_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button41.Click
Dim i As Integer
Dim t = 1
b = CDec(TextBox1.Text)
If b >= 0 Then
For i = 1 To b
t = t * i
Next
TextBox1.Text = t
Else
Exit Sub
End If
End Sub
Private Sub Button31_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button31.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = "s"
durum = True
End Sub
Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
b = CDec(TextBox1.Text)
TextBox1.Text = Math.Round(b)
End Sub
Private Sub Button47_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button47.Click
b = CDec(TextBox1.Text)
TextBox1.Text = Math.Abs(b)
End Sub
Private Sub Button48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button48.Click
b = CDec(TextBox1.Text)
TextBox1.Text = Int(TextBox1.Text)
End Sub
Private Sub Button38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button38.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
End If
If islem = "+" Then TextBox1.Text = a + b
If islem = "-" Then TextBox1.Text = a - b
If islem = "*" Then TextBox1.Text = a * b
If islem = "/" Then TextBox1.Text = a / b
If islem = "^" Then TextBox1.Text = a ^ b
If islem = "s" Then TextBox1.Text = a ^ (1 / b)
If islem = "a" Then TextBox1.Text = Math.Log(a) / Math.Log(b)
islem = "a"
durum = True
End Sub
Private Sub Button43_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button43.Click
b = CDec(TextBox1.Text)
TextBox1.Text = Math.Exp(TextBox1.Text)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
b = CDec(TextBox1.Text)
TextBox1.Text = 10 ^ b
End Sub
Private Sub Button49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
TextBox1.Text = Math.PI
End Sub
Private Sub Button50_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button50.Click
Form2.Show()
End Sub
Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
If durum2 = True Then
b = CDec(TextBox1.Text)
TextBox1.Text = a * b / 100
End If
End Sub
Private Sub Button40_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button40.Click
b = CDec(TextBox1.Text)
TextBox1.Text = b ^ (1 / 3)
End Sub
End Class
Form2
Public Class Form2
Dim t1, t2, t3, t4, t5, t6 As Integer
Dim ortalama, stndartspma, varyans, toplamx, toplamxkare, xkareort As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Clear()
TextBox1.Focus()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
t1 = 0
For k = 0 To ListBox1.Items.Count - 1
t1 = t1 + ListBox1.Items.Item(k)
Next
ortalama = t1 / ListBox1.Items.Count
Form1.TextBox1.Text = ortalama
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
t2 = 0
For k = 0 To ListBox1.Items.Count - 1
t2 = t2 + (ListBox1.Items(k) - ortalama) ^ 2
Next
stndartspma = Math.Sqrt(t2 / ListBox1.Items.Count - 1)
Form1.TextBox1.Text = stndartspma
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
t3 = 0
For k = 0 To ListBox1.Items.Count - 1
t3 = t3 + (ListBox1.Items(k) - ortalama) ^ 2
Next
varyans = t3 / ListBox1.Items.Count - 1
Form1.TextBox1.Text = varyans
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
ListBox1.Items.Clear()
TextBox1.Focus()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
t4 = 0
For k = 0 To ListBox1.Items.Count - 1
t4 = t4 + ListBox1.Items.Item(k)
Next
toplamx = t4
Form1.TextBox1.Text = toplamx
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
t5 = 0
For k = 0 To ListBox1.Items.Count - 1
t5 = t5 + (ListBox1.Items(k)) ^ 2
Next
toplamxkare = t5
Form1.TextBox1.Text = toplamxkare
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
t6 = 0
For k = 0 To ListBox1.Items.Count - 1
t6 = t6 + (ListBox1.Items.Item(k)) ^ 2
Next
xkareort = t6 / ListBox1.Items.Count
Form1.TextBox1.Text = xkareort
End Sub
End Class
Edit : Link eklemeyi unutmuşum..
İndirmek için Tıklayınız.