0

In C#, as shown in the photo I have form1 (main form) with 12 buttons and with 12 panels (each panel contains 10 buttons).

so form1 has panel1, panel2 ..... panel12 and each panel is controlled (show/hide) by one of those 12 buttons in form1 , I want when I click button1 panel1 shows up, click button2 panel2 shows up and panel1 hides, click button3 panel3 shows up and and panel2 hides ... and so on. I just want to show a panel at time and hide the others. I know how to play with show/hide panels but the problem is:

form1 has 12 buttons,12 panels each of which has 10 big buttons and this means I can not fit all this buttons and panels in form1 (no space) and I dont want to create new form for each panel (popup form). I want to do it like next/previous wizard.

Can you please help how to achieve this, is there any other ways/tools or idea to do it? Thank you

Photo

naouf
  • 627
  • 2
  • 18
  • 28
  • Not sure I follow, are you essentially saying that you want to show/hide a panel depending on which of the main forms 12 buttons is pressed? – Daniel Casserly Nov 09 '15 at 13:06
  • Can't you just use tab control instead of those panels? This seems like so much extra work for close to no benefit. – Gnqz Nov 09 '15 at 13:11
  • Daniel Casserly. yes exactly and I know how to do it but the problem is how to fit all those buttons and panels in one form. or is there other way to achieve it? thank you – naouf Nov 09 '15 at 13:15
  • Gnqz . I thought about tab control but tab control wont meet the requirement of the application which I am developing. – naouf Nov 09 '15 at 13:17
  • Would it be an option to create a usercontrol for each panel, place all the controls on the usercontrols and switch out the currently needed usercontrol in your main form on button click? – Martin Nov 09 '15 at 13:20
  • 1
    why not just have one panel with 12 buttons, and change captions, handlers, etc. dynamically as the conceptual panel changes? – NDJ Nov 09 '15 at 13:20
  • 1
    http://stackoverflow.com/questions/2340566/creating-wizards-for-windows-forms-in-c-sharp/2342320#2342320 – Hans Passant Nov 09 '15 at 13:28
  • Hi Martin . yes it is a good option. I had a look at Usercontrols and I created form1 with button1 and botton2 and also created Usercontrol1 and Usercontrol2 and . now in form1 I want to call Usercontrol1 when button1 is pressed and then press button2 to show Usercontrol2 and hide Usercontrol1 but I dont know how to do it. I created an object for Usercontrol1 (Usercontrol1.visible = true) but it didnt work. please help. thank you – naouf Nov 09 '15 at 18:35
  • Hi NDJ. yes I can consider this option but can you please explain more about what steps to follow? thank you – naouf Nov 09 '15 at 19:04

0 Answers0