locked
Class Issue RRS feed

  • Question

  • User-1988629748 posted

    I have a class (see below)

    Imports Microsoft.VisualBasic
    Imports System.Data.SqlClient
    
    
    Public Class ClientProfile
    
    #Region "Variables"
        Private _FirstName As Integer
        Public Property FirstName() As Integer
            Get
                Return _FirstName
            End Get
            Set(ByVal value As Integer)
                _FirstName = value
            End Set
        End Property
    
        Private _LastName As Double
        Public Property LastName() As Double
            Get
                Return _LastName
            End Get
            Set(ByVal value As Double)
                _LastName = value
            End Set
        End Property
    
    
    #End Region
    End Class
    
    

    It is in the file ClientProfile I have placed in both App_Code and also App_Code/Models

    In my code behind I have the following

     

    Dim NewClient As New ClientProfile

    The last word, "ClientProfile" has the scary squiggly red line below it. It is not recognizing my class.Even the Intellisense is not picking up te class.

    Do I have to register the class file in any way?

    Friday, July 22, 2011 9:34 AM

Answers

All replies

  • User-837620913 posted

    Have you done a CLEAN and then REBUILD (not just build)?  That usually works.

    Friday, July 22, 2011 1:06 PM
  • User-843484705 posted

    if you are using namespace with class then use/import namespace with it. but make sure you clean the solution and rebuild it again.

    Friday, July 22, 2011 1:10 PM
  • User-1988629748 posted

    Clean and Rebuild did not work.

    I moved the class .vb file from app_code/models to app_code to the web's root. I cleaned and rebuilt each time and it did not seem to recognize it.

    I also tried to add the NameSpace to the class .vb file, and then in the code-behind and added the IMPORTS ClientProfile, it did not seem to recognize it.

    I am at a loss.

    Friday, July 22, 2011 1:38 PM
  • User-578657687 posted

    Hi,

    Please check this tutorial and then recreate a web application to test the class of App_Code.

    http://www.codeproject.com/KB/aspnet/AspNetAppFolder.aspx

    By the way, this topic about Shared Code Folder in ASP.NET Web site you may have a check:

    http://msdn.microsoft.com/en-us/library/t990ks23(VS.80).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 27, 2011 2:33 AM