若按钮为Command1,数值加1的文本框为Text1。
在Command1_Click中输入:
Text1.Text = Val(Text1.Text) + 1
即可。
界面上放一个按钮(Command)、一个标签(Label)
代码如下:
Private Sub Command1_Click()
Label1 = Label1 + 1
End Sub
Private Sub Form_Load()
Label1 = 0
Command1.Caption = "+1"
End Sub
代码如下:
Private Sub Command1_Click()
Text1.Text = Text1.Text + 1 'Text1.Text是字符串框体
End Sub
Private Sub Form_Load()
Text1.Text = 0 '这是在Text1.Text首先显示0,执行上述程序后在这个文本框+1.
End Sub
private
sub
command1_click()
text1
=
val(text1)
+
1
end
sub