Results 1 to 6 of 6

Thread: How would i define a type in a class module?

  1. #1

    Thread Starter
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    How would i define a type in a class module?

    Ihave added 2 class modules to my project from a working project, wel i get the error user-defined type not defined when compiling from my project but is fine fine from the working app.

    So i obvioulsy have to define something somewhere, this is the code that causes the errors,

    VB Code:
    1. Public Property Get NewEnum() As IUnknown
    2.     err.Clear
    3.     On Error Resume Next
    4.    
    5.     Set NewEnum = colSockets.[_NewEnum]
    6. End Property

  2. #2
    Member
    Join Date
    Mar 2004
    Location
    Texas
    Posts
    53

    Re: How would i define a type in a class module?

    Originally posted by Jmacp
    So i obvioulsy have to define something somewhere, this is the code that causes the errors
    Are you sure that is the code, I paste it into a new form and it causes no problems. What I think is happening is that you are using that stuff before it is defined, so check to see where you defined that, try moving it to the top of 1 module or the form. Goodluck
    Good programming site:
    *http://www.planet-source-code.com

    Our CS Clan Page:
    *http://h2p.inter-gamer.com/index.html

  3. #3
    Lively Member MedevH's Avatar
    Join Date
    Aug 2001
    Location
    Where I walk, I walk alone. Where I code, I code alone.
    Posts
    91

    Re: How would i define a type in a class module?

    Originally posted by Jmacp
    VB Code:
    1. Public Property Get NewEnum() As IUnknown
    2.     err.Clear
    3.     On Error Resume Next
    4.    
    5.     Set NewEnum = colSockets.[_NewEnum]
    6. End Property
    Uhhhh...?
    Ok dude you may want to think about quitting using VB forever...

    Yeah I know what it sounds like...but I'm not flaming ya, just stating you may be more comfortable coding in C# or something

    The code I'm quoting looks very similar to C#
    There is no good or evil only CODE! ~MedevH~

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Re: How would i define a type in a class module?

    Originally posted by MedevH
    Uhhhh...?
    Ok dude you may want to think about quitting using VB forever...

    Yeah I know what it sounds like...but I'm not flaming ya, just stating you may be more comfortable coding in C# or something

    The code I'm quoting looks very similar to C#
    That's perfectly valid VB code. I use it all the time, to expose an enumerator for a For Each loop.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    Resolved it, i had no reference to OLE automation set.

  6. #6
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I think what Medevh means is it isn't everyday you find VB programmers having to use IUnknown, except for enumeraters and hacky shell extentions. C++ would make it much smother and vastly more complex... I think....

    VB and COM Interfaces..... IDL..... pain in the butt......

    Collections do kick @$$ though I remember reading and starting to use the house bricks as microsoft puts it, imporved my ability to do data operations and create biz objects almost as much as when I fell and hit my head and realized what an array was for.
    Magiaus

    If I helped give me some points.

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