模块级变量 出错 。请帮忙看下。
Dim a As Double
a = Val(Form1.Text1.Text)
Private Sub Command1_Click()
Text2.Visible = True
Text2.Text = Fix(a)
End Sub
Private Sub Command2_Click()
Text2.Visible = True
Text2.Text = Int(a)
End Sub
Private Sub Command3_Click()
Text2.Visible = True
Text2.Text = Abs(a)
End Sub
Private Sub Command4_Click()
Text2.Visible = True
Text2.Text = Sgn(a)
End Sub
Private Sub Command5_Click()
Text2.Visible = True
Text2.Text = Sqr(a)
End Sub
Private Sub Command6_Click()
Text2.Visible = True
Text2.Text = Exp(a)
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text2.Visible = False
Command1.Caption = "fix(x)"
Command2.Caption = "int(x)"
Command3.Caption = "abs(x)"
Command4.Caption = "sgn(x)"
Command5.Caption = "sqr(x)"
Command6.Caption = "exp(x)"
End Sub
------------------------------------------
a = Val(Form1.Text1.Text) 插到每个单击事件中就有用了 。就不知道为什么 “模块的通用声明段”