请哪位老师解答!关于计算的程序
请教:一个简单的股票利润计算程序,为何会计算不出正确的结果?Private m1, m2, c1, c2, x2, s1 As Single
Private Sub Command2_Click()
m1 = 0: m2 = 0: c1 = 0: c2 = 0: x2 = 0: s1 = 0
Text1.Text = 0: Text2.Text = 0: Text3.Text = 0:
Label1.Caption = " "
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub form_load()
m1 = 0: m2 = 0: c1 = 0: c2 = 0: x2 = 0: s1 = 0
Text1.Text = " ": Text2.Text = " ": Text3.Text = " "
Label1.Caption = "0"
End Sub
Private Sub Text1_gotfocus()
Text1.Text = " "
End Sub
Private Sub text1_lostfocus()
If Text1.Text = " " Then Text1.Text = "0"
End Sub
Private Sub Text2_gotfocus()
Text2.Text = " "
End Sub
Private Sub text2_lostfocus()
If Text2.Text = " " Then Text2.Text = "0"
End Sub
Private Sub Text3_gotfocus()
Text3.Text = " "
End Sub
Private Sub text3_lostfocus()
If Text3.Text = " " Then Text3.Text = "0"
End Sub
Private Sub Command1_Click()
m1 = CInt(Text1.Text): s1 = CInt(Text2.Text)
c1 = m1 * s1 * 1.005
m2 = CInt(Text3.Text)
c2 = m2 * s1 * 0.005 + c1
x2 = m2 * s1 - c2
Label1.Caption = x2
End Sub