There is a MenuStrip, by clicking on different tabs of which in the same form there are different fields to fill. The question is how is it easier to do? You can, of course, write a separate method that will programmatically remove all past controls from the old tab and create new ones, setting positions and all other properties, but this is too irrational, I think. Is it possible to somehow prepare in advance individual components that will already contain input fields and, depending on the tab, simply bind this particular component to the form? Thank you in advance.

  • Google UserControls - Specter
  • And why for tabs MenuStrip is used? Is this your design (in terms of design) approach? - rasmisha

1 answer 1

Need to implement in the vlazhkah There are two options. The first is simplified for the average number of tabs, easier to implement and edit. The second - for any number of tabs, you can say professional (but I do not recommend using it if you are just starting).

  1. You create everything in TabControl. When you select a menu, activate the desired tab. Initially, before the appearance of the form, you install these tabs invisible. Only it is necessary to take into account that when hiding tabs, the size will slightly change. But with the right layout, the problem should not arise, as there is Anchor.
  2. You create UserControl for each case. By choosing the menu, you delete the previous control from the container (Panel), dynamically add a new one.

Everything. Elementary.

  • Yes, thanks, I did the second way, because the tabs were already originally. - nvse