建立一个command控件数组
'请用单击事件
Private Sub Combo1_Click()
Dim i As Integer
For i = 0 To Combo1.ListCount - 1
If i = Combo1.ListIndex Then
Command1(i).Visible = True
Else
Command1(i).Visible = False
End If
Next
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 11
Combo1.AddItem Str(i + 1) & "月"
Command1(i).Caption = "按钮" & Str(i + 1)
Command1(i).Visible = False
Next
End Sub