RyanBonomo
RyanBonomo

Reputation: 1

C# Remove Unwanted GUI Method in Visual Studio

New to Visual Studio C# forms...

Unwanted GUI Methods for group box and labels:

    private void groupBox1_Enter(object sender, EventArgs e)
    {

    }

    private void folderPathLabel_Click_1(object sender, EventArgs e)
    {

    }

    private void destinationPathLabel_Click(object sender, EventArgs e)
    {

    }

Error Code when I delete methods:

Error 1 'A_Better_Backer.Form1' does not contain a definition for 'groupBox1_Enter' and no extension method 'groupBox1_Enter'

Upvotes: 0

Views: 1933

Answers (2)

MaMazav
MaMazav

Reputation: 1884

When adding such events, besides adding the method in the question, Visual Studio IDE automatically adds registration to the appropriate events of those methods (such as GroupBox.Enter, Label.Click) to the Designer code. You have to delete this registration code also.

Upvotes: 1

Z .
Z .

Reputation: 12837

Go to the control with the error (in your case groupBox1) and remove the OnEnter event handler. You can right-click on the control and select Properties, then click on the events icon in the properties window (looks like a lightning) and then delete the unused event handler.

Upvotes: 1

Related Questions