0

It randomly encounters these errors, even when I don't mess with anything at all. It says

"Error 4 'application.Form1' does not contain a definition for 'comboBox4_SelectedIndexChanged' and no extension method 'comboBox4_SelectedIndexChanged' accepting a first argument of type 'awesome_application.Form1' could be found (are you missing a using directive or an assembly reference?) C:\Users\admin\Documents\Visual Studio 2012\Samples\application\awesome application\Form1.Designer.cs 223 81 awesome application

It had 10 occurrences of this, and has happened before. It also makes it so I cannot look at the form1.cs [design]. This is what the code looks like in the error area.

// comboBox4
        // 
        this.comboBox4.DisplayMember = "<DEFAULT>";
        this.comboBox4.FormattingEnabled = true;
        this.comboBox4.Items.AddRange(new object[] {
        resources.GetString("comboBox4.Items")});
        resources.ApplyResources(this.comboBox4, "comboBox4");
        this.comboBox4.Name = "comboBox4";
        this.comboBox4.SelectedIndexChanged += new System.EventHandler(this.comboBox4_SelectedIndexChanged);

The error is at "system.EventHandler(this.comboBox4_selectedIndexChanged" at the end. Thanks for helping.

b13rg
  • 480
  • 6
  • 15
  • 1
    You may inadvertently remove the method `comboBox4_SelectedIndexChanged`, note that it should be defined somewhere in your class, otherwise all the occurences you found mean nothing. – King King Aug 23 '13 at 20:30
  • I assume your `Form1` actually has a method called `comboBox4_SelectedIndexChanged`? Have you tried a clean/rebuild? Are there any other compilation errors other than this one? – Steve Aug 23 '13 at 20:47

1 Answers1

1

You probably removed the method: this.comboBox4_SelectedIndexChanged which is generated in your code by the designer. You can solve this by:

1) Add a new method if you want to keep a handler for the combobox.

private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
{
}

2) Remove the this.comboBox4.SelectedIndexChanged += new System.EventHandler(this.comboBox4_SelectedIndexChanged); from your designer file if you don't need that eventhandler.

King King
  • 61,710
  • 16
  • 105
  • 130
Jeroen van Langen
  • 21,446
  • 3
  • 42
  • 57