inherited windows form with .net5

Pasc059 1 Reputation point
2021-01-14T15:57:49.353+00:00

Hi,

I remark that there is no entry in the 'Add new element' wizard to create an inherited Windows form for a .Net5 C# Windows Form project.

Someone can gives explantion or solution?

Regards

Developer technologies | Windows Forms
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Karen Payne MVP 35,596 Reputation points Volunteer Moderator
    2021-01-14T16:25:20.213+00:00

    Since there is no wizard and if you want to use one form as a base form for other form you can do the following.

    Here Form1 will be the base form to Form2, click on the arrow.

    56692-11111111111.png

    Change : Form

    using System.Windows.Forms;  
      
    namespace MoveToNextControl  
    {  
        public partial class Form2 : Form  
        {  
            public Form2()  
            {  
                InitializeComponent();  
            }  
        }  
    }  
      
    

    To

    using System.Windows.Forms;  
      
    namespace MoveToNextControl  
    {  
        public partial class Form2 : Form1  
        {  
            public Form2()  
            {  
                InitializeComponent();  
            }  
        }  
    }  
      
    

    Or use export Template
    56703-22222222222222.png

    0 comments No comments

  2. Pasc059 1 Reputation point
    2021-01-14T18:33:35.73+00:00

    Hi,

    Thanks for your quick reply Karen, this can solves partially my problem. Indeed, the main problem (that i did not mentioned) is that, any way, inherited forms can not be opened by the Forms designer with projects targetting x64 cpu (a very old issue).

    I'm afraid that i will have to adopt a new strategy for my inherited forms (put them in a separate any cpu dll,...?); currently i maintain an x86 version just for Windows Form design(er), but this becomes difficult (some of the components i use exist only for x64). Any suggestions?

    regards


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.