Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label2.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Label1.Text = "+"
Label3.Text = "="
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label2.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
Label1.Text = "-"
Label3.Text = "="
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Label2.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
Label1.Text = "*"
Label3.Text = "="
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Label1.Text = "/"
Label3.Text = "="
If Val(TextBox2.Text) = 0 Then
Label2.Text = "錯誤"
Else
Label2.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
Exit Sub
End If
End Sub
End Class
文章定位:
人氣(64) | 回應(0)| 推薦 (
0)| 收藏 (
0)|
轉寄
全站分類:
不分類