0

I have a program that when I click the "next" button, another window appears with the same form or other components appear.

I tried to add a panel on the main form with two buttons "home" and "next" and then a panel where you can see other forms to give the feeling that the page is changing. In the constructor I try to pass the previous form and the main one so that when clicked it returns to it with all its elements.

DesktopReserve formPadre;
DesktopPrincipal deskPrincipal;

public Form1(DesktopReserve formPadre, DesktopPrincipal deskPrincipal)
{
  InitializeComponent();
            
  this.formPadre = formPadre;
  this.deskPrincipal = deskPrincipal;
  this.deskPrincipal.returnButton.Click += new System.EventHandler(this.returnButton_Click);
}

I understand that this is not the best way to do it. Apart from the fact that when I show the different forms within this panel it shows in another size, I would like to know a more efficient way to execute this.

Ken White
  • 123,280
  • 14
  • 225
  • 444
1kgdelate
  • 3
  • 1
  • 2
    you can use `TabControl` – Vivek Nuna Dec 30 '22 at 11:09
  • 2
    The usual way is to create a series of UserControls and display them usually in a Form. A UC is like a form but meant to be part of some container. Lots of examples around here.. - Have a list of instances of the UCs you created and let the user move forwanrd and back, like a wizard.. – TaW Dec 30 '22 at 23:15
  • 3
    A multi-step form is sometimes called a "wizard." See [Creating Wizards for Winforms in c#](https://stackoverflow.com/questions/2084048/creating-wizards-for-win-forms-in-c-sharp) – John Wu Dec 31 '22 at 00:24
  • Thanks! I didn't know the name of what I was trying to do, now I can implement it in a better way – 1kgdelate Jan 19 '23 at 17:31

0 Answers0