I am just porting a project from VB6 to VB.NET with the help of the Microsoft Upgrade Wizard.
One form was automatically upgraded to
Friend Partial Class frmAudFeedSentenceEdit
Inherits System.Windows.Forms.Form
But when I add a new form to a new project in VB.NET, it is declared as
Public Class frmAudFeedSentenceEdit
(without the Inherits System.Windows.Forms.Form).
Which one is correct, please?
When you make a form using Visual Studio, it will put the form information into 2 separate files.
The part you’re seeing:
Is just the declaration in the main file, where you will normally work.
However, there is a second file created (
frmAudFeedSentenceEdit.Designer.vb) which will have:As you can see, it’s still a
Partial Class, but theInheritsstatement is placed in the designer-generated file for you.You can see this if you look in the
Class Viewwindow, browse to your form, and double click onInitializeComponent()(as this Sub is defined in the designer file).