Last post Mar 28, 2007 02:04 AM by Benson Yu - MSFT
Mar 22, 2007 07:12 AM|alvin r|LINK
I have developed my application in visual sudio 2003
Now i am using visual studio 2005
In VS 2003 i have given the page name and form id as the same.
But in VS 2005 i am getting an error CS0542 :"Form1" member names cannot be the same as their enclosing type
Is there is any way i could solve this error without changing the form id.
Mar 28, 2007 02:04 AM|Benson Yu - MSFT|LINK
Hi alvin r,
I can reproduce your issue by set same name to form id in page and class name in code behind file. From my research, I cannot find any solution to resolve the
issue without changing the form id or class name.
Change the name maybe result in some related issues. I understand the inconvenience the issue may cause to you. But I think this is the most efficient way to resolve
your issue. Thanks.
The difference is caused by the changing page compilation model between ASP.Net 1.1 and 2.0. In 1.1, the class where the "Form" control is defined inherits the
class where the page is defined (e.g. the code-behind). In 2.0, the "Form" control is defined in the same class where the page is defined.
Following link refer to this kind of error.