CS0102 Error on moving declaration to code-behind

csharp South Africa
  • 10 years ago


    Any assistance on this one, driving me crackers (%->)

    If I move a declaration of a TreeView from the designer.cs file to the code-behind file and change the scope from protected to public, the compiler has no problem.

    But, at run-time (when I access the page) I get an exception saying that the variable has been re-declared!

    It seems that the auto-generated desginer.cs file is being re-created and then their is a variable conflict 'cos I have moved the declaration.



Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone” - Bjarne Stroustrup