CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2001
    Posts
    3

    Return User Type from a property

    Does anybody know how to return a User Type from a property such as:


    Public Property Get MyType() as [User Type in question]
    MyType = [user type]
    End Property


    VB is giving an error for that!

    The user Type is declared in a standard module and used in a class module.

    Thanks in advance!


  2. #2
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    13

    Re: Return User Type from a property

    Include you type in class module. Be aware that this is only possible with ActiveX DLL project type.

    option Explicit

    public Type MyType
    x as Long
    y as Long
    End Type

    private t as MyType

    public property get GetMyType() as MyType
    GetMyType = t
    End property




    Next question!

  3. #3
    Join Date
    Mar 2001
    Posts
    3

    Re: Return User Type from a property

    -Be aware that this is only possible with ActiveX DLL project type.


    That's what I needed to know, thanks!



  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Return User Type from a property

    It should be possible also in activex exe project. The limitation is: a public creatable class (look for innstancing property of the class).
    Once you have defined your user defined type in a class, you zhould be able to pass it to functions or subs in forms, bas, dll,..., module, provided that you declared instances of it with the
    (private/public) myHereType as myclass.myType formula

    Best regards,
    Cesare Imperiali

    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

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

Featured