inherits

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • portroe

    inherits

    Hi all,

    I have built a base class person.vb, which is defined

    Public MustInherit Class Person

    My second class is called student.vb, which has as its first line

    Public Class Student
    Inherits Person

    I however receive an error in the code here saying, type person is not
    defined,

    I have obviously overlooked something,

    any help apprecaited

    thanks

    Portroe

  • Jan Tielens

    #2
    Re: inherits

    Some possible causes:
    1) Are the 2 classes in the same namespace?
    2) Are there any syntax errors in the Person class?

    --
    Greetz,
    Jan
    _______________ _______________ ____
    Read my weblog: http://weblogs.asp.net/jan
    "portroe" <bob@sleigh.com > schreef in bericht
    news:uBtzXrTyDH A.3220@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi all,
    >
    > I have built a base class person.vb, which is defined
    >
    > Public MustInherit Class Person
    >
    > My second class is called student.vb, which has as its first line
    >
    > Public Class Student
    > Inherits Person
    >
    > I however receive an error in the code here saying, type person is not
    > defined,
    >
    > I have obviously overlooked something,
    >
    > any help apprecaited
    >
    > thanks
    >
    > Portroe
    >[/color]


    Comment

    • Peter Row

      #3
      Re: inherits

      Hi,

      The definition for Student doesn't come before the End Class of Person does
      it?

      I've done this before, accidentially defining one class inside another. It
      caused
      a fair bit of confusion till I spotted it because it auto-syntaxed it, found
      in the
      object viewer etc...

      Regards,
      Peter
      "portroe" <bob@sleigh.com > wrote in message
      news:uBtzXrTyDH A.3220@tk2msftn gp13.phx.gbl...[color=blue]
      > Hi all,
      >
      > I have built a base class person.vb, which is defined
      >
      > Public MustInherit Class Person
      >
      > My second class is called student.vb, which has as its first line
      >
      > Public Class Student
      > Inherits Person
      >
      > I however receive an error in the code here saying, type person is not
      > defined,
      >
      > I have obviously overlooked something,
      >
      > any help apprecaited
      >
      > thanks
      >
      > Portroe
      >[/color]


      Comment

      • Armin Zingler

        #4
        Re: inherits

        "portroe" <bob@sleigh.com > schrieb[color=blue]
        > I have built a base class person.vb, which is defined
        >
        > Public MustInherit Class Person
        >
        > My second class is called student.vb, which has as its first line
        >
        > Public Class Student
        > Inherits Person
        >
        > I however receive an error in the code here saying, type person is
        > not defined,[/color]

        Which namespaces are the classes part of?


        --
        Armin




        Comment

        • portroe

          #5
          Re: inherits

          Okay found it,

          it was not in the solution explorer,

          so I just added new and pasted code again,

          I have no idea how I did this,

          thanks

          Portroe

          Peter Row wrote:
          [color=blue]
          > Hi,
          >
          > The definition for Student doesn't come before the End Class of Person does
          > it?
          >
          > I've done this before, accidentially defining one class inside another. It
          > caused
          > a fair bit of confusion till I spotted it because it auto-syntaxed it, found
          > in the
          > object viewer etc...
          >
          > Regards,
          > Peter
          > "portroe" <bob@sleigh.com > wrote in message
          > news:uBtzXrTyDH A.3220@tk2msftn gp13.phx.gbl...
          >[color=green]
          >>Hi all,
          >>
          >>I have built a base class person.vb, which is defined
          >>
          >>Public MustInherit Class Person
          >>
          >>My second class is called student.vb, which has as its first line
          >>
          >>Public Class Student
          >> Inherits Person
          >>
          >>I however receive an error in the code here saying, type person is not
          >>defined,
          >>
          >>I have obviously overlooked something,
          >>
          >>any help apprecaited
          >>
          >>thanks
          >>
          >>Portroe
          >>[/color]
          >
          >
          >[/color]

          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: inherits

            * portroe <bob@sleigh.com > scripsit:[color=blue]
            > I have built a base class person.vb, which is defined
            >
            > Public MustInherit Class Person
            >
            > My second class is called student.vb, which has as its first line
            >
            > Public Class Student
            > Inherits Person
            >
            > I however receive an error in the code here saying, type person is not
            > defined,
            >
            > I have obviously overlooked something,[/color]

            1. Are the classes in the same project? If not, set a reference.
            2. Are the classes in the same namespace and/or are namespaces
            imported? If not, then add them to the same namespace or import the
            namespace of the base class.
            3. If nothing works, type the 'Person' in the definition of the base
            class again (that's a bug which sometimes occurs, don't know why).

            --
            Herfried K. Wagner [MVP]
            <http://www.mvps.org/dotnet>

            Comment

            Working...