楼上搞错了好像,应该把事件写在Command的Click()事件里面
Private Sub Command1_Click()
If Command1.Caption = "A" Then
Command1.Caption = "B"
ElseIf Command1.Caption = "B" Then
Command1.Caption = "A"
Else
Command1.Caption = "A"
End If
End Sub
'放置一个按钮,把按钮的名称改为command1
Private Sub Command1_Click()
If Command1.Caption = "A" Then
Command1.Caption = "B"
Else
Command1.Caption = "A"
End if
end sub
在button1_click事件写:
if button1.caption="A" Then
button1.caption="B"
else
button1.caption="A"
end if
Private Sub Form_Load()
If Command1.Caption = "A" Then
Command1.Caption = "B"
ElseIf Command1.Caption = "B" Then
Command1.Caption = "A"
Else
Command1.Caption = "A"
End If
End Sub