在vb中如何使一个按钮点击一次变换名称在点击就会结束

如题所述

试一下 :
Private Sub Command1_Click()
If Command1.Caption = "退出" Then
Unload Me
Else
Command1.Caption = "退出"
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "确定"
End Sub
温馨提示:内容为网友见解,仅供参考
第1个回答  2012-03-18
Dim i As Integer

Private Sub Command1_Click()
Command1.Caption = "111"
i = i + 1
If i = 2 Then
End
End If

End Sub

先在通用里面定义一个变量 然后单击一次时变量改变 再单击一次时变量达到条件 触发END 退出
第2个回答  2012-03-19
If 按钮.Caption = "结束" Then
End
ElseIf 按钮.Caption = "弹出信息框" Then
按钮.Caption = "结束"
MsgBox "信息内容"
End If

关闭窗口使用Unload Me,完全退出程序使用 end
相似回答