参考代码:
Option Explicit
Private Const STR_TITLE As String = "我要好好学VB"
Private Const STR_RUN As String = "运行"
Private Const STR_END As String = "结束"
Private Const STR_PRINT As String = "欢迎加入Visual Basic的世界"
Private Sub Command1_Click()
If Command1.Caption = STR_RUN Then
Print STR_PRINT
Print STR_TITLE
Command1.Caption = STR_END
Else
Unload Me
End If
End Sub
Private Sub Form_Load()
Me.Caption = STR_TITLE
Command1.Caption = STR_RUN
End Sub
动画效果:
添加2个按钮一个 运行 一个退出 点击运行时按钮隐藏 退出按钮显示即可