Hi Peter,
As you have discovered the paramarray in VB.Net must be passed byVal which
as I'm sure you're aware means that you're actually passing a copy of the
values to the function. There for the original values will not be changed
even if you make changes in the function. See the following knowledge base
articles for more information about ParamArrays in VB.Net
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbup1003.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/
vblrfvbspec7_1_6_4.asp
Since it appears that you're also returning an object from the function one
solution for you will be to use an additional ByRef parameter that contains
the updated values. For example:
Public Function mytestmethod(ByRef ModifiedArgs() As Object, ByVal
ParamArray args() As Object) As Object
ModifiedArgs = args.Clone
ModifiedArgs(0) = 12
ModifiedArgs(1) = "abc"
Dim reValue As Object = "some value"
Return reValue
End Function
Sub mycalling()
Dim a As Integer = 66
Dim b As String = "zyz"
Dim r As Object
Dim NewValues() As Object
r = mytestmethod(NewValues, a, b)
a = NewValues(0)
b = NewValues(1)
MsgBox(a)
MsgBox(b)
End Sub
Hope that helps.

Signature
John Hart, Microsoft VB Team
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
> Thread-Topic: paramarray
> thread-index: AcPjQ/7JgZCJ5WZ/Q36zk8Pno1G1FQ==
> X-Tomcat-NG: microsoft.public.dotnet.languages.vb.upgrade
> From: "=?Utf-8?B?cGV0ZXI=?=" <anonymous@discussions.microsoft.com>
> References: <8BA5FAA8-7797-4D47-A3D2-8BE326536652@microsoft.com>
<OuLXIVp4DHA.984@TK2MSFTNGP11.phx.gbl>
> Subject: Re: paramarray
> Date: Sun, 25 Jan 2004 05:06:07 -0800
[quoted text clipped - 12 lines]
> Path: cpmsftngxa07.phx.gbl
> Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.languages.vb.upgrade:6123
> NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
> X-Tomcat-NG: microsoft.public.dotnet.languages.vb.upgrade
>
> I 'm sorry for my inattention.Now I correct it as follow:
Function mytestmethod(paramarray byval arg() as object) as
object
arg(0)=12
arg(1)="abc"
dim revalue as object="some value"
return revalue
End Function
Sub mycalling()
dim a as integer=66
dim b as string="xyz"
dim r as object
r=mytestmethod (a,b)
msgbox (a)
msgbox (b)
End Sub
You might misunderstand my intention.My requirement is as follow:
1)in VB.NET
2)passing uncertain number of parameters to the called function and
retrieve the modified value of these parameters.
3)passing parameters via parameter list,just as
r=mytestmethod (arg1,arg2,arg3)
not via array as
dim argarray() as object={arg1,arg2,arg3}
r=mytestmethod (arg1,arg2,arg3)
Hope your suggestion.