private x as integer 全局变量 也可累加
虽然你写 private 私有化 在其他窗体无法引用,但在这个窗体里 是全局
n是哪里定义的?
x是全局的,在整个程序执行中都不会被归零。
private sub command1_click()
static y as integer
Private x as integer
Dim z as integer
n=10
z=n+z
y=y+z
x=x+z
label1.caption=x
label2.caption=y
label3.caption=z
End Sub
这样就是10 30 10