Home All Groups Group Topic Archive Search About

Function that returns an Array

Author
28 Feb 2007 12:38 AM
Les
Whats the best way to handle passing a variable to a function and have the
function return an array??

ie A( ) = Function (argument)

The function inside will set up an array which I want to give to the calling
section.

Thanks in advance,

Les

Author
28 Feb 2007 12:50 AM
Bob Butler
"Les" <v**@prodigy.net> wrote in message
news:uF36pDtWHHA.1208@TK2MSFTNGP03.phx.gbl
> Whats the best way to handle passing a variable to a function and
> have the function return an array??
>
> ie A( ) = Function (argument)
>
> The function inside will set up an array which I want to give to the
> calling section.

Dim A() As whatever

A=myfunc

Function myfunc() As whatever()
....
End Function

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
28 Feb 2007 9:10 AM
Les
Hi Bob,

I already thanked you for your help but never saw it displayed here.  You
make it look so simple thanks.

Les

Show quoteHide quote
"Bob Butler" <tiredofit@nospam.ever> wrote in message
news:Oh596JtWHHA.1120@TK2MSFTNGP02.phx.gbl...
> "Les" <v**@prodigy.net> wrote in message
> news:uF36pDtWHHA.1208@TK2MSFTNGP03.phx.gbl
> > Whats the best way to handle passing a variable to a function and
> > have the function return an array??
> >
> > ie A( ) = Function (argument)
> >
> > The function inside will set up an array which I want to give to the
> > calling section.
>
> Dim A() As whatever
>
> A=myfunc
>
> Function myfunc() As whatever()
> ...
> End Function
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
Author
28 Feb 2007 3:51 PM
Robert Morley
On a related note, I seem to remember having to pass some arrays as Variants
at some point, but I can't remember the specifics of when that is or
why...can someone remind me?  Or is this just a hold-over in my mind from
older versions of VB/VBA?


Thanks,
Rob

Show quoteHide quote
"Bob Butler" <tiredofit@nospam.ever> wrote in message
news:Oh596JtWHHA.1120@TK2MSFTNGP02.phx.gbl...
> "Les" <v**@prodigy.net> wrote in message
> news:uF36pDtWHHA.1208@TK2MSFTNGP03.phx.gbl
>> Whats the best way to handle passing a variable to a function and
>> have the function return an array??
>>
>> ie A( ) = Function (argument)
>>
>> The function inside will set up an array which I want to give to the
>> calling section.
>
> Dim A() As whatever
>
> A=myfunc
>
> Function myfunc() As whatever()
> ...
> End Function
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
Author
28 Feb 2007 5:08 PM
Jeff Johnson
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:Oq$kpC1WHHA.1636@TK2MSFTNGP02.phx.gbl...

> On a related note, I seem to remember having to pass some arrays as
> Variants at some point, but I can't remember the specifics of when that is
> or why...can someone remind me?  Or is this just a hold-over in my mind
> from older versions of VB/VBA?

Hmm, when you use the ParamArray keyword in a procedure declaration then the
members of that array are Variants but you don't have to explicitly PASS
them as Variants, so that probably isn't what you're thinking of.

Dunno. I've rarely passed or returned arrays in my code.
Author
28 Feb 2007 5:28 PM
Robert Morley
No, I'm not thinking of ParamArrays, I know that.  Like I say, it may be a
holdover from older versions of VB/VBA, but I'm pretty sure that at one
point, if you wanted to pass an array to or from a function, you had to use
a Variant to hold it.  Maybe it was only fixed arrays or something of that
nature?  I don't remember exactly.

Like you, I've rarely had reason to do so, which is why I'm a little foggy
as to what the limitation was, exactly.


Rob

Show quoteHide quote
"Jeff Johnson" <i.get@enough.spam> wrote in message
news:%23oJkHs1WHHA.4872@TK2MSFTNGP03.phx.gbl...
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:Oq$kpC1WHHA.1636@TK2MSFTNGP02.phx.gbl...
>
>> On a related note, I seem to remember having to pass some arrays as
>> Variants at some point, but I can't remember the specifics of when that
>> is or why...can someone remind me?  Or is this just a hold-over in my
>> mind from older versions of VB/VBA?
>
> Hmm, when you use the ParamArray keyword in a procedure declaration then
> the members of that array are Variants but you don't have to explicitly
> PASS them as Variants, so that probably isn't what you're thinking of.
>
> Dunno. I've rarely passed or returned arrays in my code.
>
Author
28 Feb 2007 5:36 PM
Jeff Johnson
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:%23ykN631WHHA.4216@TK2MSFTNGP02.phx.gbl...

> No, I'm not thinking of ParamArrays, I know that.  Like I say, it may be a
> holdover from older versions of VB/VBA, but I'm pretty sure that at one
> point, if you wanted to pass an array to or from a function, you had to
> use a Variant to hold it.  Maybe it was only fixed arrays or something of
> that nature?  I don't remember exactly.
>
> Like you, I've rarely had reason to do so, which is why I'm a little foggy
> as to what the limitation was, exactly.

Perhaps it was the use of the Array() function, which always creates an
array of Variants? Just shooting in the dark here. I know how frustrating it
can be to try to dig something up from the depths of your memory, especially
if you've just made something up and as such will NEVER get an answer. (I
HATE that!)
Author
28 Feb 2007 5:39 PM
Bob Butler
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:Oq$kpC1WHHA.1636@TK2MSFTNGP02.phx.gbl
> On a related note, I seem to remember having to pass some arrays as
> Variants at some point, but I can't remember the specifics of when
> that is or why...can someone remind me?  Or is this just a hold-over
> in my mind from older versions of VB/VBA?

IIRC you can only return an array explicitly in VB6.  In VB5 and earlier you
had to use a Variant for the function return.  If you need to move back and
forth between the 2 then a Variant will still work fine in VB6.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
28 Feb 2007 6:00 PM
Robert Morley
So maybe that's where I got it from.  The other thing I was thinking was
multi-dimensional arrays...I don't think there's a mechanism to pass or
return multi-dimensional arrays in VB6, is there?


Rob

Show quoteHide quote
"Bob Butler" <tiredofit@nospam.ever> wrote in message
news:epNyq91WHHA.1016@TK2MSFTNGP04.phx.gbl...
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:Oq$kpC1WHHA.1636@TK2MSFTNGP02.phx.gbl
>> On a related note, I seem to remember having to pass some arrays as
>> Variants at some point, but I can't remember the specifics of when
>> that is or why...can someone remind me?  Or is this just a hold-over
>> in my mind from older versions of VB/VBA?
>
> IIRC you can only return an array explicitly in VB6.  In VB5 and earlier
> you
> had to use a Variant for the function return.  If you need to move back
> and
> forth between the 2 then a Variant will still work fine in VB6.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
Author
28 Feb 2007 6:08 PM
Karl E. Peterson
Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
> So maybe that's where I got it from.  The other thing I was thinking was
> multi-dimensional arrays...I don't think there's a mechanism to pass or
> return multi-dimensional arrays in VB6, is there?

Passing arrays has been a feature in MSBasic *at least* since the QB days.  I'm not
sure, but I suspect there's no issue with returning multidimension arrays directly
in VB6, and you could certainly do so within a Variant since those abominations were
invented.  Prior to that, it was more common to pass an array by reference, have the
function fill it, and return it as a modified parameter.
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
28 Feb 2007 6:34 PM
Robert Morley
Yay, I've figured out what I was thinking of!  Woohoo!

http://support.microsoft.com/kb/204823

As you can tell, I very rarely deal with passing arrays in VB.



Rob

Show quoteHide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:e%234cxN2WHHA.4764@TK2MSFTNGP05.phx.gbl...
> Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
>> So maybe that's where I got it from.  The other thing I was thinking was
>> multi-dimensional arrays...I don't think there's a mechanism to pass or
>> return multi-dimensional arrays in VB6, is there?
>
> Passing arrays has been a feature in MSBasic *at least* since the QB days.
> I'm not sure, but I suspect there's no issue with returning multidimension
> arrays directly in VB6, and you could certainly do so within a Variant
> since those abominations were invented.  Prior to that, it was more common
> to pass an array by reference, have the function fill it, and return it as
> a modified parameter.
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>
Author
28 Feb 2007 9:45 PM
Karl E. Peterson
Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
> Yay, I've figured out what I was thinking of!  Woohoo!
>
> http://support.microsoft.com/kb/204823
>
> As you can tell, I very rarely deal with passing arrays in VB.

Arrays as properties are a tricky case, yeah.  Depending on the volatility of the
data, sometimes I just expose one element at a time.  Depends how they're being
used.

  Property Get TheArray(ByVal Index As Long) As Whatever

  Property Let TheArray(ByVal Index As Long, ByVal NewValue As Whatever)

<shrug>
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
28 Feb 2007 10:11 PM
Robert Morley
Yeah, I've faked an array that way once or twice before.  It's a convenient
"trick", for lack of a better word.


Rob

Show quoteHide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:%23Le7UH4WHHA.5060@TK2MSFTNGP06.phx.gbl...
> Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
>> Yay, I've figured out what I was thinking of!  Woohoo!
>>
>> http://support.microsoft.com/kb/204823
>>
>> As you can tell, I very rarely deal with passing arrays in VB.
>
> Arrays as properties are a tricky case, yeah.  Depending on the volatility
> of the data, sometimes I just expose one element at a time.  Depends how
> they're being used.
>
>  Property Get TheArray(ByVal Index As Long) As Whatever
>
>  Property Let TheArray(ByVal Index As Long, ByVal NewValue As Whatever)
>
> <shrug>
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>
Author
28 Feb 2007 6:10 PM
Bob Butler
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:OPnj6J2WHHA.4860@TK2MSFTNGP04.phx.gbl
> So maybe that's where I got it from.  The other thing I was thinking
> was multi-dimensional arrays...I don't think there's a mechanism to
> pass or return multi-dimensional arrays in VB6, is there?

sure, just don't specify the number of dimensions...

Private Sub Main()
Dim a() As String
a = getarray
MsgBox UBound(a, 2)
End Sub

Function getarray() As String()
Dim x() As String
ReDim x(1 To 5, 1 To 10)
getarray = x
End Function


--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
28 Feb 2007 6:21 PM
Rick Rothstein (MVP - VB)
> So maybe that's where I got it from.  The other thing I was thinking was
> multi-dimensional arrays...I don't think there's a mechanism to pass or
> return multi-dimensional arrays in VB6, is there?

Returning multi-dimensional arrays is fine to do in VB6. Here is an
example...

Function PassBackDynamicArray(ParamArray Values()) As Long()
  Dim X As Long
  Dim Y As Long
  Dim TempArray() As Long
  ReDim TempArray(0 To 1, 0 To UBound(Values) \ 2)
  On Error Resume Next
  For X = 0 To 1
    For Y = 0 To UBound(TempArray, 2)
      TempArray(X, Y) = Values(X + 2 * Y)
    Next
  Next
  PassBackDynamicArray = TempArray
End Function

Private Sub Form_Load()
  Dim MyArray() As Long
  MyArray = PassBackDynamicArray(1, 2, 3, 4, 5, 6, 7)
  MsgBox "Number of dimensions = " & CStr(UBound(MyArray) + 1)
End Sub

Just pass in more than two numbers. Oh, and make sure you use a dynamic
array to receive the result (no numbers between the parentheses in the
declaration statement).

Rick
Author
28 Feb 2007 6:35 PM
Robert Morley
Okay, that makes sense.  I can't remember the last time I needed a
multi-dimensional array for anything, so I thought maybe that's why it was
so vague for me.  As you can see elsewhere, I've figured out what it was I
was trying to dredge up.  Woohoo!



Thanks,
Rob

Show quoteHide quote
"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
message news:%23egzAV2WHHA.528@TK2MSFTNGP03.phx.gbl...
>> So maybe that's where I got it from.  The other thing I was thinking was
>> multi-dimensional arrays...I don't think there's a mechanism to pass or
>> return multi-dimensional arrays in VB6, is there?
>
> Returning multi-dimensional arrays is fine to do in VB6. Here is an
> example...
>
> Function PassBackDynamicArray(ParamArray Values()) As Long()
>  Dim X As Long
>  Dim Y As Long
>  Dim TempArray() As Long
>  ReDim TempArray(0 To 1, 0 To UBound(Values) \ 2)
>  On Error Resume Next
>  For X = 0 To 1
>    For Y = 0 To UBound(TempArray, 2)
>      TempArray(X, Y) = Values(X + 2 * Y)
>    Next
>  Next
>  PassBackDynamicArray = TempArray
> End Function
>
> Private Sub Form_Load()
>  Dim MyArray() As Long
>  MyArray = PassBackDynamicArray(1, 2, 3, 4, 5, 6, 7)
>  MsgBox "Number of dimensions = " & CStr(UBound(MyArray) + 1)
> End Sub
>
> Just pass in more than two numbers. Oh, and make sure you use a dynamic
> array to receive the result (no numbers between the parentheses in the
> declaration statement).
>
> Rick
>
Author
28 Feb 2007 5:40 PM
Ralph
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:Oq$kpC1WHHA.1636@TK2MSFTNGP02.phx.gbl...
> On a related note, I seem to remember having to pass some arrays as
Variants
> at some point, but I can't remember the specifics of when that is or
> why...can someone remind me?  Or is this just a hold-over in my mind from
> older versions of VB/VBA?
>
>

You could also do this...

Dim A() As whatever
myfunc( A)

Sub myfunc(  x() As whatever )
or
Sub myfunc( x() As Variant )
or
Sub myfunc( x As Variant)
....
End Sub

But all of these would entail a certain amount of validity/type checking,
and thus fail to answer the OP's quest for a "best way" to return an Array.

Bob's was a "best way" answer. <g>

-ralph
Author
28 Feb 2007 6:04 PM
Robert Morley
Yup, I know you can do all of those...the only question is why you would
HAVE to use the last version "Sub myfunc(x As Variant)" instead of using
either of the first two.

PS, thanks for trying to help me dredge up this faint memory and figure out
where it's from, everyone.


Rob

Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:u4SdnVlpIINgIHjYnZ2dnUVZ_tijnZ2d@arkansas.net...
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:Oq$kpC1WHHA.1636@TK2MSFTNGP02.phx.gbl...
>> On a related note, I seem to remember having to pass some arrays as
> Variants
>> at some point, but I can't remember the specifics of when that is or
>> why...can someone remind me?  Or is this just a hold-over in my mind from
>> older versions of VB/VBA?
>>
>>
>
> You could also do this...
>
> Dim A() As whatever
> myfunc( A)
>
> Sub myfunc(  x() As whatever )
> or
> Sub myfunc( x() As Variant )
> or
> Sub myfunc( x As Variant)
> ...
> End Sub
>
> But all of these would entail a certain amount of validity/type checking,
> and thus fail to answer the OP's quest for a "best way" to return an
> Array.
>
> Bob's was a "best way" answer. <g>
>
> -ralph
>
>
>
>
Author
1 Mar 2007 7:54 AM
Ralph
Show quote Hide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:u4SdnVlpIINgIHjYnZ2dnUVZ_tijnZ2d@arkansas.net...
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:Oq$kpC1WHHA.1636@TK2MSFTNGP02.phx.gbl...
> > On a related note, I seem to remember having to pass some arrays as
> Variants
> > at some point, but I can't remember the specifics of when that is or
> > why...can someone remind me?  Or is this just a hold-over in my mind
from
> > older versions of VB/VBA?
> >
> >
>
> You could also do this...
>
> Dim A() As whatever
> myfunc( A)
>
> Sub myfunc(  x() As whatever )
> or
> Sub myfunc( x() As Variant )
> or
> Sub myfunc( x As Variant)
> ...
> End Sub
>
> But all of these would entail a certain amount of validity/type checking,
> and thus fail to answer the OP's quest for a "best way" to return an
Array.
>
> Bob's was a "best way" answer. <g>
>
> -ralph
>

Oops!

[Surprised I didn't get flamed. <g>]

Sub myfunc( x() As Variant )
wouldn't work unless ...
Dim A() As Variant

-ralph
Author
1 Mar 2007 6:43 PM
Karl E. Peterson
Ralph <nt_consultin***@yahoo.com> wrote:
> Oops!
>
> [Surprised I didn't get flamed. <g>]
>
> Sub myfunc( x() As Variant )
> wouldn't work unless ...
> Dim A() As Variant

I think you pretty much lose the "payin' attention" crowd, just as soon as you bring
Variants into the discussion. <g>
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
1 Mar 2007 7:10 PM
Robert Morley
Hmm...something seems to be stripping messages out on me.  This is the
second message today that simply hasn't shown up (Ralph's Oops message, that
is), where I've only found out about it when someone replied to it.  I'll
blame it on MS's servers, for lack of anything better to blame it on. :)
Makes me wonder what else I might've missed, though.


Rob

Show quoteHide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:%23%2363RGDXHHA.1000@TK2MSFTNGP05.phx.gbl...
> Ralph <nt_consultin***@yahoo.com> wrote:
>> Oops!
>>
>> [Surprised I didn't get flamed. <g>]
>>
>> Sub myfunc( x() As Variant )
>> wouldn't work unless ...
>> Dim A() As Variant
>
> I think you pretty much lose the "payin' attention" crowd, just as soon as
> you bring Variants into the discussion. <g>
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>
Author
1 Mar 2007 7:26 PM
Karl E. Peterson
I think it's OE, actually.  Happens to me, on occassion.
--
..NET: It's About Trust!
http://vfred.mvps.org


Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
Show quoteHide quote
> Hmm...something seems to be stripping messages out on me.  This is the
> second message today that simply hasn't shown up (Ralph's Oops message, that
> is), where I've only found out about it when someone replied to it.  I'll
> blame it on MS's servers, for lack of anything better to blame it on. :)
> Makes me wonder what else I might've missed, though.
>
>
> Rob
>
> "Karl E. Peterson" <k***@mvps.org> wrote in message
> news:%23%2363RGDXHHA.1000@TK2MSFTNGP05.phx.gbl...
>> Ralph <nt_consultin***@yahoo.com> wrote:
>>> Oops!
>>>
>>> [Surprised I didn't get flamed. <g>]
>>>
>>> Sub myfunc( x() As Variant )
>>> wouldn't work unless ...
>>> Dim A() As Variant
>>
>> I think you pretty much lose the "payin' attention" crowd, just as soon as
>> you bring Variants into the discussion. <g>
>> --
>> .NET: It's About Trust!
>> http://vfred.mvps.org
Author
1 Mar 2007 11:29 PM
Bob O`Bob
Karl E. Peterson wrote:
> I think it's OE, actually.  Happens to me, on occassion.

Probably the usual matter of multiple msnews "slave" servers not being fully
synchronized.  Since OE has the inexplicable habit of breaking and rebuilding
NNTP connections on apparently dramatically less than even a whim, it may be
encountering new posts in such a sequence that it mistakenly marks slightly
older article numbers as invalid.

Oddly enough, /servers/ created by MS make the worst possible combination
with OE.

Back when I was even willing to do testing with OE, I found it essential to
almost continuously refresh any groups served by MS hosts.

It seems just about established fact that the creators [of MSIMN, which became
OE] never even knew what "an RFC" was.  Probably didn't care, either.  Whereas
the creators of the IIS "News" service apparently did all /their/ work from
within a completely different NMP ("not my problem") field.  Probably neither
team knew (or cared) what "NNTP" meant.  Putting the two together results in
performance about as sensible and predictable as channel-surfing between
"keystone cops" and "three stooges" classics while expecting to see
a consistent story.



    Bob
--
Author
2 Mar 2007 5:56 PM
Robert Morley
Well well well!  I just "found" the "missing" messages.  When I clicked on
the newsgroup and then used the Tools, Get Next <x> Headers command, all of
a sudden, the missing messages were downloaded and flagged as unread.
Interesting solution, even if it's a little irritating to have to do it.


Rob

Show quoteHide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:u3rCCeDXHHA.2256@TK2MSFTNGP02.phx.gbl...
>I think it's OE, actually.  Happens to me, on occassion.
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>
>
> Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
>> Hmm...something seems to be stripping messages out on me.  This is the
>> second message today that simply hasn't shown up (Ralph's Oops message,
>> that
>> is), where I've only found out about it when someone replied to it.  I'll
>> blame it on MS's servers, for lack of anything better to blame it on. :)
>> Makes me wonder what else I might've missed, though.
>>
>>
>> Rob
>>
>> "Karl E. Peterson" <k***@mvps.org> wrote in message
>> news:%23%2363RGDXHHA.1000@TK2MSFTNGP05.phx.gbl...
>>> Ralph <nt_consultin***@yahoo.com> wrote:
>>>> Oops!
>>>>
>>>> [Surprised I didn't get flamed. <g>]
>>>>
>>>> Sub myfunc( x() As Variant )
>>>> wouldn't work unless ...
>>>> Dim A() As Variant
>>>
>>> I think you pretty much lose the "payin' attention" crowd, just as soon
>>> as
>>> you bring Variants into the discussion. <g>
>>> --
>>> .NET: It's About Trust!
>>> http://vfred.mvps.org
>
>
>
Author
1 Mar 2007 11:32 PM
Ralph
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:OycXaVDXHHA.4872@TK2MSFTNGP03.phx.gbl...
> Hmm...something seems to be stripping messages out on me.  This is the
> second message today that simply hasn't shown up (Ralph's Oops message,
that
> is), where I've only found out about it when someone replied to it.  I'll
> blame it on MS's servers, for lack of anything better to blame it on. :)
> Makes me wonder what else I might've missed, though.
>
>
> Rob
>
<snipped>

Or you might wisely placed me on your 'ignore' list. <g>

-ralph
Author
2 Mar 2007 12:16 AM
Robert Morley
Hahaha, no, I didn't do that.

OE could well be the problem too.  Apparently the problems continue, since I
never saw Karl's reply to my message either.  I'll look around for a
different newsreader somewhere and see if I can find anything useful.  OE
was so convenient, though.  Not tonight, though...way too tired to fiddle
with a new program. :)


Rob

Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:8NKdnRclj4ub_3rYnZ2dnUVZ_qKqnZ2d@arkansas.net...
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:OycXaVDXHHA.4872@TK2MSFTNGP03.phx.gbl...
>> Hmm...something seems to be stripping messages out on me.  This is the
>> second message today that simply hasn't shown up (Ralph's Oops message,
> that
>> is), where I've only found out about it when someone replied to it.  I'll
>> blame it on MS's servers, for lack of anything better to blame it on. :)
>> Makes me wonder what else I might've missed, though.
>>
>>
>> Rob
>>
> <snipped>
>
> Or you might wisely placed me on your 'ignore' list. <g>
>
> -ralph
>
>
>
Author
2 Mar 2007 12:20 AM
Ralph
Show quote Hide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:%23%2363RGDXHHA.1000@TK2MSFTNGP05.phx.gbl...
> Ralph <nt_consultin***@yahoo.com> wrote:
> > Oops!
> >
> > [Surprised I didn't get flamed. <g>]
> >
> > Sub myfunc( x() As Variant )
> > wouldn't work unless ...
> > Dim A() As Variant
>
> I think you pretty much lose the "payin' attention" crowd, just as soon as
you bring
> Variants into the discussion. <g>
> --

LOL

I have noticed that. It makes my gaffe worse as I enjoy Variants - abusing
the hell out of them whenever performance is not an issue.

Should have known better.

-ralph
<g>
Author
1 Mar 2007 7:48 AM
J French
On Wed, 28 Feb 2007 10:51:42 -0500, "Robert Morley"
<rmor***@magma.ca.N0.Freak1n.sparn> wrote:

>On a related note, I seem to remember having to pass some arrays as Variants
>at some point, but I can't remember the specifics of when that is or
>why...can someone remind me?  Or is this just a hold-over in my mind from
>older versions of VB/VBA?

In VB5 you could/can not return an Array as the result of a Function
unless it was wrapped in a Variant.