|
-
Jan 16th, 2003, 09:46 AM
#1
Thread Starter
Addicted Member
adding class in vs.net asp.net project
Hi,
I have some code that I want to use in an existing vs.net project. I add a class in the IDE and paste the code into into it.
Else where in the project I use this class. I import the namespace it is contained in and intellisense recognises the various member variables and functions within it. However when I run the project (an asp.net application) I get the errormessage "Type 'myClass' is not defined".
Do I have to create a new dll project thing, compile the class and add it to the bin directory or should the class be automatically compiled into the project dll?
Also when I make changes to the class code will it automatically recognise these when the project is recompiled?
Thanks,
Alex
ASP, SQL, VB6, Java Script and dubious guitar playing skills.
-
Jan 16th, 2003, 09:49 AM
#2
Lively Member
add a class library to your existing project
then build your class within the library
add a reference in your original project to your class library
then you should be able to declare your class from within the original project
hope that helps
-
Jan 16th, 2003, 09:56 AM
#3
Thread Starter
Addicted Member
Do I create a new class library project put my code in then add this to the solution? I only have an option to add a class file not a class library when I am within the existing solution. It docent seem to compile this class into a seperate dll that I can reference?
Alex
ASP, SQL, VB6, Java Script and dubious guitar playing skills.
-
Jan 16th, 2003, 10:06 AM
#4
Lively Member
click right on your solution file it should say add project
click this option then add a class library
then click right on the new project that's been added and select add item from this menu you should be able to add your class
-
Jan 16th, 2003, 10:09 AM
#5
Lively Member
oh n u don't need to reference n e dll's just goto your other project where the references are and right click, select add new reference
then you should be presented with another screen along the top of this screen there should be a 'projects' tab click this and select your class library from the list and click ok
then to reference your library you need to use its name ie.
Dim MyObject as New MyLibrary.MyClass
hope thiis helps
-
Jan 17th, 2003, 10:01 AM
#6
Thread Starter
Addicted Member
Thanks Optimus for your help.
The problem seemed to be that I had some errors in my project that the compiler seemed to skip when I was working on seperate aspx files. However when I added a seperate class file these errors caused the compiler to not recompile the projects dll hence the error.
Adding the classes your way was successful as the dll was seperate from the main project.
Thanks,
Alex
ASP, SQL, VB6, Java Script and dubious guitar playing skills.
-
Jan 17th, 2003, 10:03 AM
#7
Lively Member
no probs glad i could help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|