帮我看下哪里出错了

来源:百度知道 编辑:UC知道 时间:2024/06/13 15:33:02
Private Sub Command1_Click()
Dim a As String
Dim Shape1 As String
If a = state1 Then a = state2
Shape1.FillColor = vbWhite
Else: a = state1
Shape1.FillColor = vbBlack
End If
End Sub

Private Sub Form_Load()

a = state1
Shape1.FillColor = vbBlack

End Sub

说是无效限定符 Shape1.FillColor = vbWhite这里被标出了
还是Shape1.FillColor = vbWhite这里错误不是If a = state1 Then a = state2这里

去掉Dim Shape1 As String
Shape1 因该是个Shape控件

If a = state1 Then
a = state2
Shape1.FillColor = vbWhite
Else
a = state1
Shape1.FillColor = vbBlack
End If

If a = state1 Then a = state2
不能写到一行 应该这样

Private Sub Command1_Click()
Dim a As String
Dim Shape1 As String
If a = state1 Then
a = state2
Shape1.FillColor = vbWhite
Else
a = state1
Shape1.FillColor = vbBlack
End If
End Sub