Valhalla Legends Forums Archive | Visual Basic Programming | ParamArray Usage?

AuthorMessageTime
TheNewOne
Does anyone know how to use ParamArray that can help me learn how to use it. Ive tried msdn and i couldnt recollect enough from it to actually use it. Any help is greatly appreciated.
June 19, 2004, 6:48 AM
Lenny
You should also try Google.........
http://www.vb-helper.com/howto_param_array.html

Its purpose is just as it sounds, an array of parameters...If you wanted to send a dynamic number arguments you use paramarray.

This is frequently used in the addChat function of most bots...
It allows you to:
[code]rtbadd "Text1", color1
[/code]
and also use the same method to do:
[code]rtbadd "Text1", color1, "Text2", color2
etc...
[/code]

rtbadd Function:
[code]
Public Sub rtbAdd(ParamArray Elements() As Variant)
Dim i as Integer
For i = LBound(Elements) To UBound(Elements) Step 2 'Two seaparate Parameters (Text, Color)
With SomeRtb
.SelStart = Len(.text)
.SelLength = 0
.SelColor = Elements(i + 1) 'Color
.SelText = Elements(i) 'Text
.SelStart = Len(.text)
End With
Next i
End Sub[/code]
June 19, 2004, 7:00 AM

Search