Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Importing Classes

Importing Classes

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdesignhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    malockin
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • M malockin

      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

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, Where do you define the CustomButton class? in a seperate class file in the same web project or in a seperate project?

      M 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, Where do you define the CustomButton class? in a seperate class file in the same web project or in a seperate project?

        M Offline
        M Offline
        malockin
        wrote on last edited by
        #3

        Same project, separate class file.

        Nicola

        M 1 Reply Last reply
        0
        • M malockin

          Same project, separate class file.

          Nicola

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          I guess you are using VS 2003? Can you post the code line causing the error and the error description?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups