尼桑沙漠风暴车多少钱:VB按钮事件

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/03 10:14:23
要设置按钮按第1次时提示:“请求你的帮助”
按钮按下第2次时提示:“VB程序请求你的帮助”
按钮按下第3次时提示:“谢谢你的帮助”
按钮按下第4次时提示:“非常感谢”

这个设置在VB里怎样写代码呢?请写明代码!谢谢

Option Explicit
Dim n As Integer

Private Sub Command1_Click()
n = n + 1
If n = 1 Then
Command1.Caption = "请求你的帮助"
ElseIf n = 2 Then
Command1.Caption = "VB程序请求你的帮助"
ElseIf n = 3 Then
Command1.Caption = "谢谢你的帮助"
ElseIf n >= 4 Then
n = n - 4
Command1.Caption = "非常感谢"
End If
End Sub

????????????????????????????????????????????????????????????????????????????????????????

Private n
Private Sub form_load()
n = 0
End Sub

Private Sub Command1_Click()
n = n + 1
Select Case n
Case 1
Command1.Caption = "请求你的帮助"
Case 2
Command1.Caption = "VB程序请求你的帮助"
Case 3
Command1.Caption = "谢谢你的帮助"
Case 4
Command1.Caption = "非常感谢"
End Select
If (n > 4) Then n = 0
End Sub

Private Sub Command1_Click()
Static n As Integer
n = n + 1
If n = 1 Then
Command1.Caption = "请求你的帮助"
ElseIf n = 2 Then
Command1.Caption = "VB程序请求你的帮助"
ElseIf n = 3 Then
Command1.Caption = "谢谢你的帮助"
Else
Command1.Caption = "非常感谢"
n = 0
End If
End Sub