Results 1 to 4 of 4

Thread: Passing UDT arrays

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    5
    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.



  2. #2
    Member
    Join Date
    Oct 2000
    Posts
    35
    Try the following:

    Friend Function ... (x AS SomeUdt)
    rfo

  3. #3
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    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.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
  •  



Click Here to Expand Forum to Full Width