Results 1 to 6 of 6

Thread: Public Types implemented in a Class

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Question

    Hi,
    I'm working on this program that uses plugins. I want declare and use my own publc type but I can't get it to work.

    Take a look at it

    Code:
    Modulue1.bas
    
    'Used to Sore Info about The Aothor of the Plugins
    Public Type PLUGIN_AUTHOR
       Author_Name     As String
       Author_Email    As String
       Author_Homepage As String
    End Type


    Code:
    Plugins.cls
    'This is The Plugin Class
    
    'local variable(s) to hold property value(s)
    Private mvarmnm As PLUGIN_AUTHOR 'local copy
    Public Property Set Plugs(ByVal vData As PLUGIN_AUTHOR)
    'used when assigning an Object to the property, on the left side of a Set statement.
    'Syntax: Set x.mnm = Form1
        Set mvarmnm = vData
    End Property
    
    
    Public Property Get Plugs() As PLUGIN_AUTHOR
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.mnm
        Set Plugs = mvarmnm
    End Property

    I keep getting a Compiler error, any suggestions?

    [Edited by omarswan on 05-26-2000 at 07:26 PM]
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I think you have to convert your UDT to a classmodule, I've always wished there was another way.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    Here is a trick:

    VB will not allow you to use User Types as public in class module or pass them as parameters for functions declared on module level.

    To play it around use Fried instead of public for function or properties. Theoreticaly it is not correct, but it works all right.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Question Any more suggestions

    Any more suggestions?
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  5. #5
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    What is wrong with Friend?

  6. #6
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    And UDT are not objects so:Plugins.cls
    'This is The Plugin Class

    'local variable(s) to hold property value(s)
    Private mvarmnm As PLUGIN_AUTHOR 'local copy
    Friend Property Let Plugs(ByVal vData As PLUGIN_AUTHOR)
    mvarmnm = vData
    End Property


    Friend Property Get Plugs() As PLUGIN_AUTHOR
    Plugs = mvarmnm
    End Property

    This will work.


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