Genti Saliu
Genti Saliu

Reputation: 2723

Winforms: TabControl-based Wizard with steps in separate classes and designer support

I am trying to build a wizard by using the TabControl component.

It works fine, but I end up with so many pages (tabs) that having all the components and event handlers in one class makes it unreadable.

I now have this idea of declaring each step of the wizard in a separate class which extends from TabPage, then adding those steps to the wizard screen class (which extends from TabControl). How do I do that and still get designer support in the steps?

Simply extending TabPage doesn't enable designer support.

Thanks in advance.

Upvotes: 1

Views: 1038

Answers (1)

Dan
Dan

Reputation: 9847

I would suggest splitting your business logic from your UI logic. Create UserControl derivatives for both the contents of each TabPage as well as the TabControl itself. It's a lot easier to manage this kind of code if the UI logic is separate from the business logic. You would probably benefit from creating a class for each tab, and a class that manages all the tabs. Hook these classes up to the UserControls that are on the TabPages and the TabControl.

Upvotes: 1

Related Questions