CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 1999
    Location
    Bangalore
    Posts
    60

    How to pass a userdefined type to a function in class module ?

    Hi all

    Can i have a userdefined type passed to a method in class module like any API call which accepts userdefined types.

    Thanks in advance
    -venky




  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: How to pass a userdefined type to a function in class module ?

    yap, u can pass user define type in activeX class module. like this

    public type usertype
    somethings ...
    end type

    public function test(param as usertype) as long

    cksiow
    http://vblib.virtualave.net - share our codes


  3. #3
    Join Date
    Dec 1999
    Location
    Bangalore
    Posts
    60

    Re: How to pass a userdefined type to a function in class module ?

    but it gives the error message

    "Only public user defined types of public object modules can be used as parameters or return types for public procedures of class modules or as fiedlds of public user defined types"

    I am trying this in a standard exe
    I had declared the usertype in a bas module and trying to pass it to a class module on click of a button.

    -venky



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

    Re: How to pass a userdefined type to a function in class module ?

    No...!
    you need a dll or an activex...
    make a new project, dll type
    you will have a class module
    check instance property
    be sure it is public/global or, in any case, creatable.
    declare on top of that module your userdefined type.
    in your normal exe, put a reference to the dll.
    declare in your form the userdefined type this way:
    private/public mytype as yourdllModuleName.YourType
    that's all!

    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.

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

    Re: How to pass a userdefined type to a function in class module ?

    have a look:
    http://codeguru.earthweb.com/cgi-bin...age=&view=&sb=

    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.

  6. #6
    Join Date
    Dec 1999
    Location
    Bangalore
    Posts
    60

    Re: How to pass a userdefined type to a function in class module ?

    thanx... it worked fine.

    can u tell me where can i get some details about the different types of instacing of a class.


    -venky


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

    Re: How to pass a userdefined type to a function in class module ?

    Try with msdn (=vb Help) searcing for instancies/instancy property.

    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