1

Possible Duplicate:
Creating Wizards for Windows Forms in C#

I'm new to developing VB .Net forms, and I currently have a "wizard" at the moment I just have it setup as different forms, but the problem is when changing forms Windows does the full animation and the window position can change. Which isn't that great on the user end.

The other alternative I've seen is manually hiding / showing all the elements, but that's messy and hard to maintain.

So is there a parent container in which you can dictate separate forms, so all the form logic is still in separate files, but it's accessed via the one form (from the users perspective)?

Note: I'm currently using .Show and .Hide to switch between the forms.

Using regular Windows Forms, .net 2.0

Community
  • 1
  • 1
Mattisdada
  • 979
  • 1
  • 15
  • 24
  • I'm assuming you're using Windows Forms. If you were to _tell_ us whether you're using winforms or WPF or whatever, then I wouldn't have to assume. – John Saunders Jan 02 '13 at 23:59

3 Answers3

2

You should consider putting your controls within one or more UserControls. This allows you to design and use it just like a form, but works as a single "control" which you can show or hide as needed.

See Developing Custom Windows Forms Controls with the .NET Framework on MSDN for details.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
1

You can load the form into a panel using a few tricks. I add a panel to the main form and then dim a new form, which I want to display, and add it to the panel. Want to show another form, clear the panel and load a new form. Here is the code I use to load the form into the panel:

Dim formToShow As New Form2
formToShow.TopLevel = False
formToShow.WindowState = FormWindowState.Maximized
formToShow.FormBorderStyle = Windows.Forms.FormBorderStyle.None
formToShow.Visible = True
Panel1.Controls.Add(formToShow)
Wade73
  • 4,359
  • 3
  • 30
  • 46
  • Is there anyway to forward on keyboard events to the inner form? Tabs for example doesn't work and only tabs the container form. – Mattisdada Jan 04 '13 at 04:04
  • I honestly don't know, not having run into that before and I destroyed the code I wrote. I will need to recreate it later today after my pressing work is done. – Wade73 Jan 04 '13 at 13:17
0

Put each form's controls in Panels with same size and position. So you don't have to hide all controls one by one, you can just hide a panel and show another one.

gunakkoc
  • 1,069
  • 11
  • 30