有三个command按钮,分别是:
command1,command2,command3.
和一个text1.text。在command2中过程如下:
Dim x, y, z As Integer
If x < y Then x = z
text1.text = z如何实现
command1中的x + 1
command3中的x - 1
可以使command2中的x变化,同时输出到text1.text的数据也会自动更新?请写出代码来,谢谢!
command1,command2,command3.
和一个text1.text。在command2中过程如下:
Dim x, y, z As Integer
If x < y Then x = z
text1.text = z如何实现
command1中的x + 1
command3中的x - 1
可以使command2中的x变化,同时输出到text1.text的数据也会自动更新?请写出代码来,谢谢!
Option Explicit
Dim x As IntegerPrivate Sub Command1_Click()
x = x + 1
End SubPrivate Sub Command2_Click()
Dim y As Integer, z As Integer
If x < y Then z = x
Text1.Text = zEnd SubPrivate Sub Command3_Click()
x = x - 1
End Sub
Dim x As IntegerPrivate Sub Command1_Click()
x = x + 1
Call Command2_Click
End SubPrivate Sub Command2_Click()
Dim y As Integer
y = 5
If x < y Then
Text1.Text = "有"
Else
Text1.Text = "无"
End If
End SubPrivate Sub Command3_Click()
x = x - 1
Call Command2_Click
End Sub
猴哥我想将Command2中的x,赋予初始值为3,那么该怎么写啊??
Private Sub Command2_Click()
Dim y As Integer
x = 3
y = 5
If x < y Then
Text1.Text = "有"
Else
Text1.Text = "无"
End If
End Sub
Private Sub Command2_Click()
Dim y As Integer
static f as boolean
if not f then
x = 3
f = true
end if
y = 5
If x < y Then
Text1.Text = "有"
Else
Text1.Text = "无"
End If
End Sub