Questions tagged [paramarray]
50 questions
20
votes
9 answers
Pass array to ParamArray
is it possible to pass all elements of an array to a ParamArray?
For example I'd like to pass a ParamArray to another ParamArray:
Sub test()
p1 "test", "banane", "birne"
End Sub
Sub p1(ParamArray keys() As Variant)
p2 keys 'should be the…

maiermic
- 4,764
- 6
- 38
- 77
14
votes
4 answers
Submit array param with jQuery ajax/load
public ActionResult DoSomething(string[] arr, bool someBool, int someInt) { }
trying to call the above method from jQuery:
var test = [];
test.push('dog');
test.push('cat');
$container.load('MyController/DoSomething',
{ 'arr[]':…

fearofawhackplanet
- 52,166
- 53
- 160
- 253
11
votes
1 answer
C# HttpClient Post String Array with Other Parameters
I am writing a C# api client and for most of the post requests I used FormUrlEncodedContent to post the data.
List> keyValues = new List>();
keyValues.Add(new KeyValuePair

Yasitha
- 2,233
- 4
- 24
- 36
8
votes
2 answers
Delegates and ParamArray - Workaround Suggestions?
Some predefined methods contain a ParamArray in their signature.
Delegates, however, cannot contain a ParamArray in their signature.
Question: Assume you wish to create a delegation mechanism for a specific method which requires a ParamArray. How…

M.A. Hanin
- 8,044
- 33
- 51
7
votes
2 answers
In F#, how do you curry ParamArray functions (like sprintf)?
In F#, how do you curry a function that accepts a variable number of parameters?
I have code like this...(the log function is just an example, the exact implementation doesn't matter)
let log (msg : string) =
printfn "%s" msg
log "Sample"
It…

Fendy
- 73
- 3
5
votes
0 answers
Pass Elements in Variant Array as Arguments to ParamArray
Background
I am creating a VBA function (UDF) called MyUDF(), which wraps CallByName().
I wish to mimic precisely the signature and parametric behavior of CallByName(). Furthermore, MyUDF() must copy its Args() argument to a modular variable…

Greg
- 3,054
- 6
- 27
5
votes
2 answers
Is there any way to deal with ParamArray values as byRef so they can be updated?
Sounds simple enough, but its not working. In this example, I want to set the values of 3 fields to equal a 4th. I could do something like this....
Dim str1 As String = "1"
Dim str2 As String = "2"
Dim str3 As String = "3"
Dim str4 As String =…

StingyJack
- 19,041
- 10
- 63
- 122
5
votes
2 answers
Using a ParamArray, but requiring at least one parameter
What I used to have:
Public Sub Subscribe(channel As ChannelType)
Public Sub Subscribe(channels As IEnumerable(Of ChannelType))
The first one just calls the second one with {channel} to convert its parameter into an array.
I decided that having to…

Jeff B
- 8,572
- 17
- 61
- 140
4
votes
2 answers
VBA Function to exclude parts of a string
My sub compares two lists of strings and returns the closest matches. I've found that the sub gets tripped up over some common words such as "the" and "facility". I would like to write a function that would be supplied an array of words to exclude…

ZAR
- 2,550
- 4
- 36
- 66
4
votes
2 answers
Unpacking Array into ParamArray in VBA
Given an array of unknown size and a procedure that accepts a Parameter Array, how can one pass the array as the parameter array without modifying the procedure?
Sub Example(sequence() As String)
UnModifiableSub sequence
End Sub
Sub…

cheezsteak
- 2,731
- 4
- 26
- 41
3
votes
2 answers
Array as an argument in a procedure vb6 vs vb.net
Here it is a procedure in vb6 and it is working fine like the example included:
' Check_UnCheck
' check an array of some checkboxes, uncheck an array of another checkboxes
' Example of usage :
CheckBox.Check_UnCheck Array(chkCheck3, chkCheck5),…

Max
- 53
- 5
3
votes
0 answers
COM and ParamArray
I have an issue with ParamArray. This is supposed to be OPTIONAL by default but it seems it is not so.
I have the following code in an ASP page.
dim oUtil, sSQL, oRs, bCARS
Set oUtil = server.CreateObject("CPUtility.Feature")
sSql = "select…

Jerome
- 31
- 1
3
votes
1 answer
How do I implement a method with a variable number of arguments?
How do I implement a method with a variable number of arguments?
In C#, we can use the params keyword:
public class MyClass
{
public static void UseParams(params int[] list)
{
for (int i = 0; i < list.Length; i++)
{
…

Scott Nimrod
- 11,206
- 11
- 54
- 118
3
votes
1 answer
ParamArray Not Working With COM
I have a Class Library that is exposed to COM like this:
Public Class SomeClass
Public Const ClassId As String = "GUID1"
Public Const InterfaceId As String = "GUID2"
…

Oorang
- 6,630
- 1
- 35
- 52
3
votes
1 answer
Can you pass a list in an ParamArray parameter
I'm was wondering if you can pass a list into a parameter of ParamArray in a method? For ex.
dt = ws.getTable("baseDivision.code:1",
"countryCode:CA",
"status.code:[1+TO+6]",
"buType.code:(6+7+8+88)",
"market.code:[0+TO+*]",
…

PopperJuan
- 175
- 1
- 16