After putting a textbox on my page when I compile it I get the above error:
\'txtName\' is not declared. It may be inaccessible due to its protection level.
I had a different cause for the exact same error and it is similar to what the OP found but not quite. My page.aspx.designer.vb got out of sync and had an error. One of my controls was being defined twice (I think because I copy/pasted an existing control without editing the ID before pasting). Once I deleted the 2nd declaration I could build and the errors were gone. Interestingly, VS 2010 SP1 didn't list THAT error along with the others resulting from the lack of that page building. Hope this helps someone else.