Click to See Complete Forum and Search --> : How to pass a userdefined type to a function in class module ?


venkytvs
April 23rd, 2001, 07:30 PM
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

cksiow
April 24th, 2001, 12:30 AM
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

venkytvs
April 24th, 2001, 11:42 AM
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

Cimperiali
April 24th, 2001, 11:46 AM
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.

Cimperiali
April 24th, 2001, 11:53 AM
have a look:
http://codeguru.earthweb.com/cgi-bin/bbs/wt/showpost.pl?Board=vb&Number=34447&page=&view=&sb=

Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.

venkytvs
April 24th, 2001, 12:19 PM
thanx... it worked fine.

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


-venky

Cimperiali
April 27th, 2001, 06:01 AM
Try with msdn (=vb Help) searcing for instancies/instancy property.

Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.