A
Arpan
Consider the following class named "Constructor.vb" which exists in
C:\Inetpub\wwwroot\ASPX:
Imports System
Imports System.Data
Imports System.Web
Imports System.Web.HttpResponse
Imports System.Web.UI.Page
Namespace cons
Public Class Constructor : Inherits Page
Public Sub Hello()
Response.Write("Constructor1")
End Sub
End Class
End Namespace
When I try to compile the above class (in a folder named "Business"
which is a sub-folder in the "ASPX" folder) using
vbc /t:library /out:Business/Cons.dll /r:System.dll /r:System.Data.dll
/r:System.Web.dll Constructor.vb
I get the following 2 errors:
Error1:
------
Type 'Page' is not defined.
pointing to the following line
Public Class Constructor : Inherits Page
Error2:
------
Reference to a non-shared member requires an object reference.
pointing to the following line:
Response.Write("Constructor1")
What am I doing wrong?
Secondly, to use a class in an ASPX page, is it always necessary to
compile it into a DLL & then import it as a namespace in the ASPX page?
Thanks,
Arpan
C:\Inetpub\wwwroot\ASPX:
Imports System
Imports System.Data
Imports System.Web
Imports System.Web.HttpResponse
Imports System.Web.UI.Page
Namespace cons
Public Class Constructor : Inherits Page
Public Sub Hello()
Response.Write("Constructor1")
End Sub
End Class
End Namespace
When I try to compile the above class (in a folder named "Business"
which is a sub-folder in the "ASPX" folder) using
vbc /t:library /out:Business/Cons.dll /r:System.dll /r:System.Data.dll
/r:System.Web.dll Constructor.vb
I get the following 2 errors:
Error1:
------
Type 'Page' is not defined.
pointing to the following line
Public Class Constructor : Inherits Page
Error2:
------
Reference to a non-shared member requires an object reference.
pointing to the following line:
Response.Write("Constructor1")
What am I doing wrong?
Secondly, to use a class in an ASPX page, is it always necessary to
compile it into a DLL & then import it as a namespace in the ASPX page?
Thanks,
Arpan