Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cs code behind : member names cannot be the same as their e 1

Status
Not open for further replies.

Gzk2010

Programmer
Aug 17, 2010
48
0
0
US
Why do I keep getting these erros on build?
"Error 1 'aGridView_aspNET': member names cannot be
as their enclosing type"

aGridView_aspNET.aspx.designer.cs
I get it from this peice of code in my aGridView_aspNET.aspx.designer.cs file.

I have been copying files and renaming them, but I want to be able to do this without this error.
I googled and did not see people with the same error.
the same error messgae, but not the same cause.
I want to understand why this is happening.
the part it is complaining about(with the blue under line) is aGridView_aspNET at the very bottom.

public partial class aGridView_aspNET {

/// <summary>
/// aGridView_aspNET control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl aGridView_aspNET;


}

Super Thanks in advance!
 
you have a property/method that has the same name as the class. that is not valid in C#. in C# the only member that can have the same name as the class is the constructor.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Great, but why does it keep generating the propery/method with the same name amaking me continuosly need to change it? Does anyone know?

Thanks in advance!
 
That is a symptom to the real problem. Why are you copying an pasting the form? There should not be a need to copy and paste entire forms. This is usually a sign of either
1. a flaw in your system's architecture
2. a lack of skill/understanding of how OOP works
3. trying to fix a "quirk" introduced by the IDE GUI.

1 or 2 can be solved with a better understanding of the core problem and OOP design concepts.

if you are experiencing 3, then copying and pasting the form will only reproduce the problem, not solve it. To solve the IDE quirk you need to re-create the form from scratch.

If #3 doesn't make any sense to you, then this is not the problem.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Jason, there will be know more copying and pasting for sure. I just was trying to get to the core of the problem. But I do think as you said its an IDE quirk.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top