|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Referencing Function ArgumentsIs 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. 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 Show quoteHide quote > 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. > GhostInAK wrote:
Show quoteHide quote > Hello Brian, Thanx,> > 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. > > 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. Hello Brian,
Then no. Having written the function you should know the parameters' names. -Boo Show quoteHide quote > 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. > GhostInAK wrote:
Show quoteHide quote > Hello Brian, Thanx for responding.> > 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. > > B.
changing the date format in vb.net
Datasets - use 1 or many? Assigning the result of a '/' division to an integer type causes rounding last ditch attempt to try and get this working error in the update Streamreader doesn't read the line properly identity /autonumber drives me nuts From Delphi to VB WithEvents code in module cannot change textbox on main form Complementary colors? |
|||||||||||||||||||||||