-
Maximum arguments in a function?
I have a function that has 66 parameters of which 13 are ByVal and the rest are ByRef arguments.
This function is producing the error "Too Many Arguments".
WHat is the maximum I can pass? Is there a max on byval or byref values?
Thanks,
Ninel
-
66 parameters??? whow man... don't do that, a method with more than 10 parameters is always very hard to use! (and makes very easy to do mistakes)
Group your parameters in a UDT, or even better in a Class, and pass that as argument
Marco
"There are two ways to write error-free programs. Only the third one works."
Unknown
-
Agreed - A class is the best way to go about it. But a TYPE may offer some advantages if you ever want to save any of that data to disk.
-
If it's possible to load the parameters into an array, that might be a quick & dirty approach, of course you loose the option to pass in individual values ByVal or ByRef. . .
Jeff
-
array does not work if the types of the parameters are different.
with the UDT everything will be passed byRef, but the usage of UST is restricted (can't be passed as argument to class, I do not remember on which condition because I use UDT only for private local data storage)
with a class it is possible to have some sort of read only properties (that act as byVal parameters)
"There are two ways to write error-free programs. Only the third one works."
Unknown
-
Like I said, it's a quick and dirty, of course, when dealing with 66 parameters, I would say there are some design issues. . .
Jeff
Similar Threads
-
Replies: 4
Last Post: 04-14-2006, 09:09 AM
-
By Marcos in forum VB Classic
Replies: 3
Last Post: 01-25-2006, 11:18 AM
-
By Scott in forum VB Classic
Replies: 12
Last Post: 12-21-2001, 04:21 PM
-
Replies: 1
Last Post: 11-27-2001, 06:53 AM
-
By Kunal Sharma in forum VB Classic
Replies: 2
Last Post: 04-25-2000, 03:45 PM
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|