473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Referencing Function Arguments

Is there a way to reference an argument to a function without using its
name?

Something like:

Public Function MyFunc(ByVal Arg1 As String, ByVal Arg2 As String) As
String

MsgBox(MyFunc.Arguments(1).Value)
MsgBox(MyFunc.Arguments(2).Value)

End Function

B.

Jun 14 '06 #1
4 1118
Hello Brian,

Yes.. but it's not good practice. You can declare a parameter as a ParamArray
(look it up in the help docs). But it would be best to just pass an array,
like:

public sub SomeFunction(byval tArray() as string)
Dim tIndex as integer=0

for tIndex=tArray.GetLowerBounds(0) To tArray.GetUpperBounds(0)
msgbox(tArray(tIndex)
next
end sub

-Boo
Is there a way to reference an argument to a function without using
its name?

Something like:

Public Function MyFunc(ByVal Arg1 As String, ByVal Arg2 As String) As
String

MsgBox(MyFunc.Arguments(1).Value)
MsgBox(MyFunc.Arguments(2).Value)
End Function

B.

Jun 14 '06 #2

GhostInAK wrote:
Hello Brian,

Yes.. but it's not good practice. You can declare a parameter as a ParamArray
(look it up in the help docs). But it would be best to just pass an array,
like:

public sub SomeFunction(byval tArray() as string)
Dim tIndex as integer=0

for tIndex=tArray.GetLowerBounds(0) To tArray.GetUpperBounds(0)
msgbox(tArray(tIndex)
next
end sub

-Boo
Is there a way to reference an argument to a function without using
its name?

Something like:

Public Function MyFunc(ByVal Arg1 As String, ByVal Arg2 As String) As
String

MsgBox(MyFunc.Arguments(1).Value)
MsgBox(MyFunc.Arguments(2).Value)
End Function

B.


Thanx,

Actually, i do not want to pass an array at all. It is important that
the definition of the function's arguments be exact.

B.

Jun 15 '06 #3
Hello Brian,

Then no. Having written the function you should know the parameters' names.
-Boo
GhostInAK wrote:
Hello Brian,

Yes.. but it's not good practice. You can declare a parameter as a
ParamArray (look it up in the help docs). But it would be best to
just pass an array, like:

public sub SomeFunction(byval tArray() as string)
Dim tIndex as integer=0
for tIndex=tArray.GetLowerBounds(0) To tArray.GetUpperBounds(0)
msgbox(tArray(tIndex)
next
end sub
-Boo
Is there a way to reference an argument to a function without using
its name?

Something like:

Public Function MyFunc(ByVal Arg1 As String, ByVal Arg2 As String)
As String

MsgBox(MyFunc.Arguments(1).Value)
MsgBox(MyFunc.Arguments(2).Value)
End Function
B.

Thanx,

Actually, i do not want to pass an array at all. It is important that
the definition of the function's arguments be exact.

B.

Jun 15 '06 #4

GhostInAK wrote:
Hello Brian,

Then no. Having written the function you should know the parameters' names.
-Boo
GhostInAK wrote:
Hello Brian,

Yes.. but it's not good practice. You can declare a parameter as a
ParamArray (look it up in the help docs). But it would be best to
just pass an array, like:

public sub SomeFunction(byval tArray() as string)
Dim tIndex as integer=0
for tIndex=tArray.GetLowerBounds(0) To tArray.GetUpperBounds(0)
msgbox(tArray(tIndex)
next
end sub
-Boo

Is there a way to reference an argument to a function without using
its name?

Something like:

Public Function MyFunc(ByVal Arg1 As String, ByVal Arg2 As String)
As String

MsgBox(MyFunc.Arguments(1).Value)
MsgBox(MyFunc.Arguments(2).Value)
End Function
B.

Thanx,

Actually, i do not want to pass an array at all. It is important that
the definition of the function's arguments be exact.

B.


Thanx for responding.

B.

Jun 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
16
by: phpcode | last post by:
I have a javascript function as follows: function myfunction(formName,formField) { parseInt(document.formName.formField.value) +=1; } Then I can call the function when needed like this: ...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
4
by: anonymous | last post by:
Thanks your reply. The article I read is from www.hakin9.org/en/attachments/stackoverflow_en.pdf. And you're right. I don't know it very clearly. And that's why I want to understand it; for it's...
7
by: sfeher | last post by:
Hi All, Is there a way to preserve the arguments across functions? I have: <script> function myFirstFunction() { // arguments = 'param1'
7
by: VK | last post by:
I was getting this effect N times but each time I was in rush to just make it work, and later I coudn't recall anymore what was the original state I was working around. This time I nailed the...
11
by: linq936 | last post by:
Hi, My program crashes on the following code, void lower(char* src, char* ret){ while ( src ) { char c = tolower(*src); *ret = c; <----------------------------- crash here ++ret; ++src; }
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
2
by: Fatz | last post by:
Hello, Couldn't find reference to this - apologies if that's cuz attempting it is the mark of an ignominous numpty. typedef int (FN_t)(char *, FN_t **); I'm on VMS doing this, tho that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.