Public Class Form1
Dim a, b, sonuc As Integer
Dim isaret As String
Function hesap()
Select Case isaret
Case "+"
sonuc = a + b
MsgBox("Sonuç= " & sonuc)
Case "-"
sonuc = a - b
MsgBox("Sonuç= " & sonuc)
Case "*"
sonuc = a * b
MsgBox("Sonuç= " & sonuc)
Case "/"
If b = 0 Then
MsgBox("Tanımsız", MsgBoxStyle.Information, "Ercan Akgün")
Else
sonuc = a / b
MsgBox("Sonuç= " & sonuc)
End If
End Select
Return sonuc
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = TextBox1.Text
b = TextBox2.Text
Call hesap()
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
isaret = "+"
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
isaret = "-"
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
isaret = "*"
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
isaret = "/"
End Sub
End Class
Hiç yorum yok:
Yorum Gönder