|
-
Nov 27th, 2000, 08:56 AM
#1
Thread Starter
New Member
When passing a UDT array to a function, must the function also be in a public module (.bas)?
In a .bas module I've defined the user-defined type udtMMdata as Public with string, long and single elements. In the same .bas module I then declared the udtMMdata as an array: Public arrMMdata() as udtMMdata.
When I try to pass this UDT array as an argument between two forms in my program, I get the infamous:
"Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types"
Since I have defined everything in a public object module, I can only conclude that I have to move both the passing and receiving functions into the same .bas. This seems to work so far (I'm still re-writing), but I would like to understand the underlying logic to these rules. Would it matter if I put the passing procedure into a dialog box instead of a form? Or that the receiving procedure is in a MDI child? Like I said, if I understood the logic behind all of this, I think I'd have a better shot of getting it right--not the first time, of course, but maybe the fifth...sixth? Thanks for any help; this is a great forum.
-
Nov 27th, 2000, 10:16 AM
#2
Member
Try the following:
Friend Function ... (x AS SomeUdt)
-
Nov 27th, 2000, 01:31 PM
#3
A .bas is not an object module. Object modules are forms, classes, usercontrols etc. (in general everything you can load more then one time).
If you defined the udt in a .bas, it is accessable all over your app, so you don't have to pass it as parameter.
-
Nov 27th, 2000, 02:19 PM
#4
transcendental analytic
If you declare the Type in a classmodule in a refered Dll project in your app, then you will be able to pass it from and to any public method in any object module, you should also use property get/let instead of declaring public types in them.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|