Importing Classes
-
Hello, I'm trying to use a class I've built in an ASP.NET page, but I can't seem to make it work. When compiling the project, everything is fine, but when I try to run it, I get an error saying that the class cannot be found. The code behind the page is in VB.NET, and I'm trying to instantiate the class there. For example:
--- Custom Class File --- Imports System.Web.UI.WebControls Public Class CustomButton : Inherits Button Public Sub New(Name As String) MyBase.New() MyBase.Text = Name End Sub End Class --- End of Custom Class File --- --- Main Page File --- Imports System Imports System.Web.UI Public Class MyPage : Inherits Page Protected Sub Page_Load(sender As Object, e As EventArgs) Dim b As CustomButton b = New CustomButton("Button!!") End Sub End Class --- End of Main Page File ---
What am I doing wrong? -- Nicola -
Hello, I'm trying to use a class I've built in an ASP.NET page, but I can't seem to make it work. When compiling the project, everything is fine, but when I try to run it, I get an error saying that the class cannot be found. The code behind the page is in VB.NET, and I'm trying to instantiate the class there. For example:
--- Custom Class File --- Imports System.Web.UI.WebControls Public Class CustomButton : Inherits Button Public Sub New(Name As String) MyBase.New() MyBase.Text = Name End Sub End Class --- End of Custom Class File --- --- Main Page File --- Imports System Imports System.Web.UI Public Class MyPage : Inherits Page Protected Sub Page_Load(sender As Object, e As EventArgs) Dim b As CustomButton b = New CustomButton("Button!!") End Sub End Class --- End of Main Page File ---
What am I doing wrong? -- Nicola -
Hi there, Where do you define the CustomButton class? in a seperate class file in the same web project or in a seperate project?