PDA

Click to See Complete Forum and Search --> : Passing KeyValues


krallabandi
Nov 18th, 1999, 10:57 AM
How to pass keyvalues along with their values into function as an array?
ex:
I want pass the informatin

integer: Int1
string: Str1
long: Lng1
variant : Var1
integer: Int2
string: Str2
long: Lng2
variant : Var2
to a function fun1( Var as variant)

where var(0) should be of type integer and its value is Int1
var(1) should be of type integer and its value is Str1
var(2) should be of type long and its value is Lng1
var(3) should be of type variant and its value is Var1
....and so on

please let me know ur ideas

Thanks in advance
Kiran
krallabandi@india.osius.com

Aaron Young
Nov 18th, 1999, 11:10 AM
Try the ParamArray Keyword, eg.

Private Sub Command1_Click()
MsgBox "You Passed " & MultiParams(1, "String", 3.5, 128000) & " Parameters."
End Sub

Private Function MultiParams(ParamArray aParams() As Variant) As Long
Dim I As Integer
MultiParams = UBound(aParams) + 1
For I = 0 To MultiParams - 1
MsgBox "Parameter " & (I + 1) & " = " & aParams(I) & " of Type (" & TypeName(aParams(I)) & ")"
Next
End Function


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net