Click here to Skip to main content
15,905,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a few main buttons and a lot different batch of sub-buttons for each main button. When a main button is clicked, a batch of sub-buttons will display. When another main button is clicked, previous sub-buttons will be invisible and a new batch of sub-buttons will display. Thank you. Your help is greatly appreciated.


Here is the coding:

VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button10.Click
       Dim Button1 As Button
       If Button1.Select() Then
           Button6.Visible = True
           Button7.Visible = True
           Button8.Visible = True
           Button9.Visible = True

       Else
           Button6.Visible = False
           Button7.Visible = False
           Button8.Visible = False
           Button9.Visible = False
       End If
   End Sub
Posted

Instead of doing what you are doing right now, create two panels and place the two group of buttons in each. Toggle the panel visiblity on the main button click. :thumbsup:
 
Share this answer
 
v3
alright i get it. Thanks a lot. but now the problem is, when another main button is clicked, previous sub-button should be hidden/invisible.
i have used if-else statement but how should my code goes? Button1.Select() ?
 
Share this answer
 
It would really be helpful to know what you are trying to achieve. It sounds to me like you want to jump to a particular page of controls (buttons), and could use the tabPage control, that way when you change pages you automatically hide the other buttons on that page. I.E.


VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
   
   tabPage1.show()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
   tabPage2.show()
End Sub


and so on.
 
Share this answer
 
alright i get it alr. just figured out not long. i tried your method and another simple method like :

VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button10.Click
       Panel3.Visible = True
       Panel1.Visible = False




   End Sub

   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
       Panel1.Visible = True
       Panel3.Visible = False



THANKS A LOT TO YOU GUYS ! :D
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900