Solved

Accessing a seperate class from another class

Posted on 2007-03-20
5
195 Views
Last Modified: 2011-09-20
This is a really easy question, but for some reason i cant seem to figure it out....

I have my Default.aspx page with the .cs code-behind that runs some methods. I also have another class in the App_Code folder called DataAccess.cs that has some public methods that i want to call in my Default.aspx.cs page, but i cant seem to access the class.

Any help?
0
Comment
Question by:dtddev
  • 3
  • 2
5 Comments
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18759158
for instance methods:

DataAccess da = new DataAccess();
da.RunMethod();

for static methods:
DataAccess.RunStaticMethod();

make sure the class is declared public as well
0
 

Author Comment

by:dtddev
ID: 18759291
right the only problem is that when i Type in DataAccess, it does not come up in the Intellisense
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 18759303
Can you post the contests of DataAccess (or at least the class and method definitions - you don;t need to include the code within the methods)?
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 18759309
I'm thinking it's either a namespace issue or a visibility issue (is it "class DataAccess" or "public class DataAccess")
0
 

Author Comment

by:dtddev
ID: 18759341
AH HA. i figure it out.... wow i feel stupid. I named the class DataAccess.cs but the actuall class name was sqlDataAccess..........

Thanks for your help
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question