Initialize Component Error C#

4.8k views Asked by At

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.

2

There are 2 answers

2
Amiram Korach On BEST ANSWER
  1. Remove the semicolon at the end of the first line of the constructor.
  2. Change your class name to something other than "Form".
1
Peter Stock On

A Class named Form cannot inherit another class also named Form. You have to give it a different name.