Initialize Component Error C#
-
13-07-2021 - |
Domanda
So I was all done with my program and tried to edit a few small things at the top, and started getting errors and can't change them back. Here is the code:
namespace FinalProject
{
public partial class Form : Form
{
public Form();
{
InitializeComponent();
}
}
}
I changed the Form: Form part and then it made the InitializeComponent();
into an error. Tried to change it back and its still showing the error. Undo is not an option and I'm sure it's an easy fix.
Soluzione
- Remove the semicolon at the end of the first line of the constructor.
- Change your class name to something other than "Form".
Altri suggerimenti
A Class named Form cannot inherit another class also named Form. You have to give it a different name.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow