VS2005 VB.NET WEB - variables not declared that are.

VS2005 SP1 VB.NET WEB Application

I have an application which is in devlopment and had no problem until today.  Suddenly variables that are clearlr declared are flagged  as not declared and I can no longer build the project. It appears ANY new code i add to the project sufferes this fate. So I will pick a simple example: In code behind I have.

    Protected Function LoadUsers(ByVal CaseID As String) As Boolean
        Dim strSelect As String = "SELECT USERNAME  FROM CASEUSERS WHERE (CaseID =" & Trim(CaseID) & ") ORDER BY USERNAME ASC"
        With dsCaseU
            .SelectCommand = strSelect
            .DataBind()
        End With
        dListUsers.DataBind()
    End Function

In ASPX I have

    <asp:SqlDataSource ID="dsCaseU" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                SelectCommand="SELECT DISTINCT USERNAME  FROM CaseUsers   ORDER BY USERNAME ASC">
            </asp:SqlDataSource>  

And doing a solution build I get:

E:\CMS.NET\CMSCaseBlog.aspx.vb(63,0): error BC30451: Name 'dsCaseU' is not declared.
E:\CMS.NET\CMSCaseBlog.aspx.vb(67,0): error BC30451: Name 'dListUsers' is not declared.
Validation Complete
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

Note these names are not highlighted in blue by intellisense.

Some background. The problem started this morning and I had the same as above except these variables WERE highlighted in blue in the code behind as not declared .

Out of frustration I de-installed VS2005 completely and re-installed it. I also upgraded to SP1. Now I get this result and still cannot move forward.

Am I missing somethning stupid?



rschnell11Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ethothsCommented:
Are you missing the partial class. Vb.Net 2.0 puts all the auto generated code in a seperate designer class.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SammyCommented:
check and see if any of these variables are commented out for debugging purposes
0
rschnell11Author Commented:
1. check and see if any of these variables are commented out for debugging purposes

It happens to all variables that are added now, this is not just a sample. Existing ones are Ok.  for example if I add the folloing to the end of the aspx and add another line to the vb code, now SQLdataSource1 is not declared. Any change results in variables in the code behind not declared.
CODE BEHIND  CHANGE
        dListUsers.DataBind()
        SqlDataSource1.DataBind()
:
ASPX CHANGE
              <asp:SqlDataSource ID="dsUsers" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                SelectCommand="SELECT USERNAME  FROM USERS ORDER BY USERNAME ASC">
            </asp:SqlDataSource>
           
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                SelectCommand="SELECT USERNAME  FROM USERS ORDER BY USERNAME ASC">
            </asp:SqlDataSource>
           
        </div>
    </form>
</body>
</html>


2. Mising partial class.
All the code is encompassed within the partial class
Partial Class AddNote
    Inherits System.Web.UI.Page
      .
      .
      .
End Class
0
SammyCommented:
can you check in IIS if your app is running under asp.net 2.0 and Not 1.1
0
rschnell11Author Commented:
Sorry I should have satid,its NET 2.0.
However, "ethoths" is correct. I just looked up the details oh how partial classes work. So realising the implications, I changed the name of the partial class to something I am absolutely sure is unique ... and now its all working. I still don't understand why it stopped working today as I only added the three or four lines of code and only to this class and it was just working before that. However, I guess if there is some other codebehind partilal class with a duplicate name, I understand now that there may well be a conflict, looking in the wrong aspx perhaps?

The main thing is that its working again. Thank you all.

So whilst I am not sure how the problem occured , partial class naming is the source of the problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.