Class not recognised in VS2008 .NET 3.5

Last post 08-27-2008 2:15 PM by chenthil_it. 9 replies.

Sort Posts:

  • Class not recognised in VS2008 .NET 3.5

    08-21-2008, 11:46 AM
    • Member
      59 point Member
    • Phillip J
    • Member since 08-11-2006, 5:26 PM
    • Ventura, CA.
    • Posts 203

    I have a generic class which we have been using for years successfully with only minor changes.  But now it fails all together and I do not understand why?  It is very generic in content and does little but very importent as it will not fir the ability to read from the Web.Config file

    It does not recognise teh word "GLOBAL" as a class name?

     ERROR - Public Class Global  the work "Global" produces - "Keyword is not valid as an identifyer"

    CODE----------------------------------------------------------------

    Imports System.Web
    Imports System.Web.SessionState
    Imports Microsoft.VisualBasic
    Public Class Global
    Inherits System.Web.HttpApplication

    #Region " Component Designer Generated Code "

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
       ' Fires when the application is started
        WebAppConfig.Init(Context)
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
       
    ' Fires when the session is started
    End Sub

    ...

    ...

    ...

    End Class

    Thanks
    Phillip J.
    Ventura, Ca. USA/Savusavu, Fiji
  • Re: Class not recognised in VS2008 .NET 3.5

    08-21-2008, 11:52 AM
    • All-Star
      86,764 point All-Star
    • ecbruck
    • Member since 12-30-2005, 7:39 PM
    • Des Moines, IA
    • Posts 9,209
    • Moderator
      TrustedFriends-MVPs
    Thanks, Ed

    Microsoft MVP - ASP/ASP.NET

  • Re: Class not recognised in VS2008 .NET 3.5

    08-21-2008, 12:24 PM
    • Member
      59 point Member
    • Phillip J
    • Member since 08-11-2006, 5:26 PM
    • Ventura, CA.
    • Posts 203

    Sorry this did not work form me...

    When I tried the suggestions o  "Using" instead of "Imports" at the top of my Global.asax.vb I got an error msg "statement cannot appear outside a Method body".

     

    Thanks
    Phillip J.
    Ventura, Ca. USA/Savusavu, Fiji
  • Re: Class not recognised in VS2008 .NET 3.5

    08-21-2008, 3:18 PM
    Answer
    • Contributor
      3,389 point Contributor
    • hongping
    • Member since 11-02-2006, 9:42 PM
    • Posts 633
    • AspNetTeam

    "Global" is a keyword in vb. Change the class name to another identifier.

    ==============================================
    If you get the answer to your question, please mark it as the answer.
  • Re: Class not recognised in VS2008 .NET 3.5

    08-23-2008, 7:23 AM
    Answer
    • Participant
      1,490 point Participant
    • chenthil_it
    • Member since 07-08-2008, 5:01 AM
    • Pune
    • Posts 290

    global is a keywork as per my understanding... change the name...

  • Re: Class not recognised in VS2008 .NET 3.5

    08-25-2008, 10:47 AM
    • Member
      59 point Member
    • Phillip J
    • Member since 08-11-2006, 5:26 PM
    • Ventura, CA.
    • Posts 203

    Tried renaming it to something simple... still the same... I am starting to think that there is something wrong with my install of VS???

    Thanks
    Phillip J.
    Ventura, Ca. USA/Savusavu, Fiji
  • Re: Class not recognised in VS2008 .NET 3.5

    08-27-2008, 4:54 AM
    Answer

    Phillip J:
    Public Class Global
    Inherits System.Web.HttpApplication

    Tried renaming it to something simple... still the same...

    Hi Phillip,

    I would like to know which class name you have tried to rename. I agree with “hongping” and “chenthil_it”, why not keep the default class name (Global_asax) of the Global Application Class?

    **************************** Global.asax ****************************
    <%@ Application Codebehind="Global.asax.vb" Inherits="VBWebApplication1.Global_asax" Language="vb" %>

    **************************** Global.asax.vb ****************************
    Public Class Global_asax
    Inherits System.Web.HttpApplication
     

    Sincerely,
    Benson Yu
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
  • Re: Class not recognised in VS2008 .NET 3.5

    08-27-2008, 1:39 PM
    • Participant
      1,490 point Participant
    • chenthil_it
    • Member since 07-08-2008, 5:01 AM
    • Pune
    • Posts 290
    I had similar problem. You can try this. Remove the .cs file and create a new one and put the respective code on that. It worked for me. I don't know what's the reason.
  • Re: Class not recognised in VS2008 .NET 3.5

    08-27-2008, 1:58 PM
    • Member
      59 point Member
    • Phillip J
    • Member since 08-11-2006, 5:26 PM
    • Ventura, CA.
    • Posts 203

    Thanks... that worked... but what a hack!

    Thanks
    Phillip J.
    Ventura, Ca. USA/Savusavu, Fiji
  • Re: Class not recognised in VS2008 .NET 3.5

    08-27-2008, 2:15 PM
    • Participant
      1,490 point Participant
    • chenthil_it
    • Member since 07-08-2008, 5:01 AM
    • Pune
    • Posts 290

    cool

Page 1 of 1 (10 items)