Last post Feb 16, 2009 08:32 AM by rkchaudary
Feb 16, 2009 07:20 AM|wmec|LINK
I'm with the following error
Error 1 The call is ambiguous between the following methods or properties: 'EmpApp.Form1.InitializeComponent()' and 'EmpApp.Form1.InitializeComponent()'
for these codes in C#. Any idea?
public class Form1 : Form
this.lb_user_id = new System.Windows.Forms.Label();
Feb 16, 2009 07:46 AM|rkchaudary|LINK
please post entire code / EmpApp.Form1 code,
there is an ambiguity in the method name as the clr is not able to identify which method is be called.
Feb 16, 2009 08:06 AM|wmec|LINK
Thanks. The issue is due to the existence of this file (it's defaulted to be there within the solution unless we delete it)
What's this for?
Feb 16, 2009 08:32 AM|rkchaudary|LINK
Form1.Designer.cs will hold the design related info with initialisation method ( InitializeComponent() )
however it will work only when your class has "partial" attribute (means partial class)
here you have removed the partial keyword and didn't delete the Form1.designer.cs file so it got confused as Form1.Designer.cs has one more method InitializeComponent()
You should do Now:
remove initializecomponent() from your code (not in Form1.Designer.cs)
and mark the class as partial (the way it was when you have created it)