|
-
May 15th, 2005, 11:18 PM
#1
Thread Starter
Junior Member
[Resolved] Class Help
I have 2 classes
VB Code:
Public Class One
Sub MessageOne
Response.Write("I am from Class One")
End Sub
Sub OtherMethod
'Do Something here
End Sub
End Class
Public Class Two
Sub MessageTwo
Response.Write("I am from Class Two")
End Sub
Sub OtherMethod
'Do Something here
End Sub
End Class
Now I create new class and I want to call method MessageOne and MessageTwo.
VB Code:
Public Class MyClass: Inherits System.Web.UI.Page
Dim ClassOne As New One
Dim ClassTwo As New Two
ClassOne.MessageOne()
ClassTwo.MessageTwo()
End Class
When I compile, I got error message "Type 'One' is not defined". Note: Class One and class Two are not in the same directory as MyClass. This is ASP.NET.
Thanks in advance
Last edited by Winter2OO1; May 16th, 2005 at 08:26 PM.
-
May 15th, 2005, 11:34 PM
#2
Re: Class Help
Are they in a different project or namespace?
-
May 15th, 2005, 11:41 PM
#3
Thread Starter
Junior Member
Re: Class Help
Thanks Mendhak.
they are in the same project. I tried to create different namespace for each class but I don't know how to use namespace yet.
Thanks
-
May 15th, 2005, 11:43 PM
#4
Re: Class Help
It SHOULD work then.
Try this:
Dim x as New ProjectName.One
?
-
May 15th, 2005, 11:57 PM
#5
Thread Starter
Junior Member
Re: Class Help
I think because they are in different folder
folderA/One.vb
folderB/Two.vb
folderC/MyClass.vb
Do I need to put all vb files in the same folder?
Thanks again
-
May 16th, 2005, 12:01 AM
#6
Re: Class Help
No you don't, as long as they're part of the same project.
Can you upload the project here?
-
May 16th, 2005, 08:25 PM
#7
Thread Starter
Junior Member
Re: Class Help
thanks mendhak. I got it works. I got error message because they are in different NameSpace
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
|