I keep on receiving this error message. I followed the instructions but it seems it is still not working? what is the solution for this? here’s my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Linq;
using System.Data.Linq.Mapping;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MyDatabaseDataContext = new MyDatabaseDataContext(@"C:\Users\John\Documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\MyDatabase.mdf");
}
}
}
Here’s the stacktrace
Error 1 'WindowsFormsApplication1.Form1' does not contain a definition for 'Form1_Load' and no extension method 'Form1_Load' accepting a first argument of type 'WindowsFormsApplication1.Form1' could be found (are you missing a using directive or an assembly reference?) C:\Users\John\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.Designer.cs 92 55 WindowsFormsApplication1
This happens if you add an event handler in the designer, then delete the handler method.
Since you didn’t delete the auto-generated code that adds the method to the event, you get a compiler error.
Go to the
.Designer.csfile and delete the line with the error.