Conversion Issue from VS.NET 2002 to VS.NET 2005

All the classes are converted to partial
and in the user controls
the shared property has following error.
"Reference to a non-shared member requires an object reference".





Answer this question

Conversion Issue from VS.NET 2002 to VS.NET 2005

  • superjoe30

    Hi, Vishal

    VS 2005 uses partial classes to allow multi-source-file classes. Especially useful when separating the Form developer from the code behind the form. As for the shared properties, at each of these errors you should get an option to replace the object reference with the class name. Shared properties and methods cannot access internal data structures in the class, thus the error.



  • jhusain

    Partial Public MustInherit Class workingNewHeaderControl2

    Inherits System.Web.UI.UserControl

    Protected WithEvents companyLogo As System.Web.UI.WebControls.Image

    Protected WithEvents Image1 As System.Web.UI.WebControls.Image

    Protected WithEvents Label2 As System.Web.UI.WebControls.Label

    Protected WithEvents accountLable As System.Web.UI.WebControls.Label

    Protected WithEvents TodayDate As System.Web.UI.WebControls.Label

    Public Shared Property Set_Title() As String

    Get

    End Get

    Set(ByVal Value As String)

    workingNewHeaderControl2.pageTitle.Text = Value'' it gives error here as mentioned above.

    End Set

    End Property

    WorkingNewheaderControl2 is a Web User Control which has this above mentioned

    shared property

    pagetitle is not a part of declaration

    but pagetitle is declared in HTML.

    Can you please tell me what is the work around for this.



  • Matt Greenwald

    Moving to a VC# forum.
  • Barts007

    Can you post an example

  • Conversion Issue from VS.NET 2002 to VS.NET 2005