2007-09-13 14:22:10奶茶

VB計算機的程式

加法

Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Label1.Caption = ”+”
Label2.Caption = ”=”
Label3.Caption = a + b
End Sub

減法

Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Label1.Caption = ”-”
Label2.Caption = ”=”
Label3.Caption = a - b
End Sub

乘法

Private Sub Command3_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Label1.Caption = ”*”
Label2.Caption = ”=”
Label3.Caption = a * b
End Sub

除法

Private Sub Command4_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Label1.Caption = ”/”
Label2.Caption = ”=”
Label3.Caption = a / b
End Sub

整除法

Private Sub Command5_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Label1.Caption = ””
Label2.Caption = ”=”
Label3.Caption = a b
End Sub

清除

Private Sub Command6_Click()
Text1.Text = ””
Text2.Text = ””
Text3.Text = ””
Label1.Caption = ””
Label2.Caption = ””
Label3.Caption = ””
Label4.Caption = ””
End Sub

離開

Private Sub Command7_Click()
End
End Sub

開根號

Private Sub Command8_Click()
a = Val(Text3.Text)
Label4.Caption = a ^ 0.5
End Sub


希望有資訊科的對你有用XDDDDDDD