如何用VB做一个计数器
发布网友
发布时间:2022-04-29 22:04
我来回答
共4个回答
热心网友
时间:2022-06-24 00:45
画command1
text1
在通用中定义s,假设初值为23
鼠标左键为1,右键为2
Dim
s
As
Integer
Private
Sub
Command1_MouseDown(Button
As
Integer,
Shift
As
Integer,
X
As
Single,
Y
As
Single)
If
Button
=
2
Then
s
=
s
-
1
If
Button
=
1
Then
s
=
s
+
1
Text1.Text
=
s
End
Sub
Private
Sub
Form_Load()
s
=
23
Text1.Text
=
s
End
Sub
热心网友
时间:2022-06-24 00:46
Private Sub Command1_Click()
Static n As Integer
n = n + 1
text1.text = "你点击了" & n & "次"
End Sub
热心网友
时间:2022-06-24 00:46
Private Sub Command1_Click()
Static aa As Integer
aa = aa + 1
Print aa
End Sub
或者:
dim aa as integer
Private Sub Command1_Click()
aa = aa + 1
Print aa
End Sub
热心网友
时间:2022-06-24 00:47
很简单一FOR就可以了。!