Results 1 to 7 of 7

Thread: testing a class

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    77

    testing a class

    for the lesson here, http://msdn.microsoft.com/en-us/library/ms172603.aspx
    i followed everything to the letter, and this is visual studio 2005, but the editor does not recognize the class,
    Dim person1 As New persons.persons
    the msg is : 'type persons.persons is not defined'

    i've checked a lot and all the names look correct to me, must be something simple i've missed?
    bob
    Attached Images Attached Images   

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: testing a class

    Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: testing a class

    Is the 'persons' class inside a namespace called 'persons'? Have you referenced the classTest project from your form's project?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: testing a class

    If you've added the reference correctly then it should work. That said, if you also imported the 'persons' namespace then you'd break it again. If you HAVE imported the 'persons' namespace into your WinForms project then you should be using 'persons' only, not 'persons.persons'.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    77

    Re: testing a class

    thanks for the reply, it was a rookie naming issue, when i created the class, i didn't realize it would be recognized, for purposes of identifying the class, by the name given at creation. it used the ide default, classLibrary1, so even tho i had named the project and the .vb, 'persons', it still needs the 'object' name.

    so, i'm guessing to keep the class, project, and .vb name all the same?

    and also if i make the class into a dll, and add to the components, via component services, the component name will end up being the class name?
    bob

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: testing a class

    I wouldn't necessarily keep the class name the same. You could easily have more than one class in a library, and you certainly couldn't share the name with them, but the other names might as well stay the same to make them easy to keep track of.
    My usual boring signature: Nothing

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    77

    Re: testing a class

    just want to get the terminology correct, about the library? and component services

    there is the 'class library' that is the ide new project, and there is the component services. is component services considered a library as well? my understanding to make classes accessible to any program/project (they would show in the object browser) you would save them as a dll and then add them to component services?
    or alternatively you can add any existing dll to a project in the object browser

    what are differences and /or reasons to go the component services route as opposed to adding specific dll's through the object browser?
    i'm bracing for being forwarded to a set of 2" thick manuals to answer these questions.
    bob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width