|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
pass array as a function parameterIn VB2005 I have a function that takes an array of integers
Private Sub MyGroups(ByVal grpVals() As Integer) 'blah End Sub I can call the function no problem with two variables Dim myvals() As Integer = {var1, var2} MyGroups(myvals) Is there a way to do this in one line like so MyGroups( {var1, var2}) Ive tried various ways and searched for different approaches but cant seem to find one that does it in one line. AGP look at paramarray
Show quoteHide quote "DIOS" <sindi***@gmail.com> wrote in message news:380e546a-9ce0-4a34-a29c-51e737b09dec@q33g2000vbt.googlegroups.com... > In VB2005 I have a function that takes an array of integers > > Private Sub MyGroups(ByVal grpVals() As Integer) > 'blah > End Sub > > I can call the function no problem with two variables > > Dim myvals() As Integer = {var1, var2} > MyGroups(myvals) > > Is there a way to do this in one line like so > MyGroups( {var1, var2}) > > Ive tried various ways and searched for different approaches but cant > seem to find one that does it in one line. > > AGP Am 03.06.2010 18:16, schrieb DIOS:
Show quoteHide quote > In VB2005 I have a function that takes an array of integers MyGroups(New Integer() {var1, var2})> > Private Sub MyGroups(ByVal grpVals() As Integer) > 'blah > End Sub > > I can call the function no problem with two variables > > Dim myvals() As Integer = {var1, var2} > MyGroups(myvals) > > Is there a way to do this in one line like so > MyGroups( {var1, var2}) > > Ive tried various ways and searched for different approaches but cant > seem to find one that does it in one line. Alternatively, if possible, you can declare a ParamArray: Private Sub MyGroups(ByVal ParamArray grpVals() As Integer) Call: MyGroups(var1, var2) MyGroups(myvals) -- Armin On Jun 3, 11:50 am, Armin Zingler <az.nos***@freenet.de> wrote:
Show quoteHide quote > Am 03.06.2010 18:16, schrieb DIOS: Ahhh that works, thanks for the tip.> > > > > In VB2005 I have a function that takes an array of integers > > > Private Sub MyGroups(ByVal grpVals() As Integer) > > 'blah > > End Sub > > > I can call the function no problem with two variables > > > Dim myvals() As Integer = {var1, var2} > > MyGroups(myvals) > > > Is there a way to do this in one line like so > > MyGroups( {var1, var2}) > > > Ive tried various ways and searched for different approaches but cant > > seem to find one that does it in one line. > > MyGroups(New Integer() {var1, var2}) > > Alternatively, if possible, you can declare a ParamArray: > > Private Sub MyGroups(ByVal ParamArray grpVals() As Integer) > > Call: > > MyGroups(var1, var2) > MyGroups(myvals) > > -- > Armin AGP
option strict?
Good bye... Binding to a column that is integer. Help converting a vb6 function to vbnet. Enable Visual Styles after application has started Calling unmanaged C dll from managed code Direct Client Requirement - Software Engineer (.Net) - VA - Chantilly (GC and Citizen may only apply vb.net congiguration settings vb.net share data Passing Values between forms |
|||||||||||||||||||||||