Command Button Visibility

How do you make a command button via a button on the program, called Command24, make bottons called command 27-37, go from invisible to visible mode, and visa versa
Warsteiner99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

danlevansCommented:
Private Sub Command24_Click()
    Command27.Visible = False 'invisable
    Command27.Visible = True 'visable
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VbmasterCommented:
You really should use array controls instead of using Command1, Command2, Command3 etc

Here's how to do it if you do NOT use a array control...

  Dim Control As Control

  For Each Control In Controls
    If (Control.Name Like "Command2[789]") Then
      Control.Visible = Not Control.Visible
    End If
  Next

If you used a array control you would use the code...

  Dim a As Long
  For a = 27 To 29
    Command(a).Visible = Not Command(a).Visible
  Next

If you want to convert your command buttons to a array control you can set the first buttons name to 'Command' or something, then set the second button to the same name, the third to same name etc. VB will ask you if you want to create a array control when you set the name of the second button.. you do want to do that.


Hope this helps.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.