湖人大巴:大家帮忙看看哪里错了

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/12 15:42:49
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub

Private Sub Form_Load()
Dim f As Integer
Dim e As Integer
Dim d As Integer
Dim s As Integer
Dim a As Integer
f = Val(Text1.Text)
e = Val(Text2.Text)
d = Val(Text3.Text)
s = Val(Text4.Text)
a = f + e + d + s + a
End Sub
Private Sub Command3_Click()
Label8.Caption = a

End Sub
按下command3的时候什么都没有显示
如何定义为全局的

a是你在过程Form_Load()中定义的局部变量,到过程Command3_Click()中已经不存在了。你要把a定义城全局的。

你本来就把所有的都设为空了嘛!那当然是空啦!