How to declare function to return multidimensional array 
Author Message
 How to declare function to return multidimensional array

I'm writing a web service function in which I'd like to return a
multidimensional array.  Single dimension arrays are easy:
    <WebMethod()>Public Function ArrayTest() As String()
        dim b(2) as String
        b(0)="abc"
        b(1)="def"
        return b
    End Function

But I can't figure out the declaration syntax to return a multidimensional
array.  I've been everywhere in the books and on the web but this is nowhere
to be seen. I've tried all sorts of variations. Most won't compile.  Those
that do return errors at runtime.

Thanks.

Art



Mon, 25 Jul 2005 23:00:37 GMT  
 How to declare function to return multidimensional array
Pass it as an object instead.

Can't pass strings, as you're finding out, in the world of wwww. Everything
is defined as variant.


Quote:
> I'm writing a web service function in which I'd like to return a
> multidimensional array.  Single dimension arrays are easy:
>     <WebMethod()>Public Function ArrayTest() As String()
>         dim b(2) as String
>         b(0)="abc"
>         b(1)="def"
>         return b
>     End Function

> But I can't figure out the declaration syntax to return a multidimensional
> array.  I've been everywhere in the books and on the web but this is
nowhere
> to be seen. I've tried all sorts of variations. Most won't compile.  Those
> that do return errors at runtime.

> Thanks.

> Art



Mon, 25 Jul 2005 23:49:45 GMT  
 How to declare function to return multidimensional array

Quote:
> I'm writing a web service function in which I'd like to return a
> multidimensional array.  Single dimension arrays are easy:
>     <WebMethod()>Public Function ArrayTest() As String()
>         dim b(2) as String
>         b(0)="abc"
>         b(1)="def"
>         return b
>     End Function

> But I can't figure out the declaration syntax to return a
> multidimensional array.  I've been everywhere in the books and
> on the web but this is nowhere to be seen.

ms-help://MS.VSCC/MS.MSDNVS/vbls7/html/vblrfVBSpec6_8.htm

Quote:
> I've tried all sorts
> of variations. Most won't compile.  Those that do return errors
> at runtime.

     <WebMethod()>Public Function ArrayTest() As String(,)
         dim b(1,1) as String
         b(0,0)="abc"
         b(1,0)="def"
         b(0,1)="abc"
         b(1,1)="def"
         return b
     End Function

Armin



Mon, 25 Jul 2005 23:39:51 GMT  
 How to declare function to return multidimensional array
Could you give me a simple example or a pointer to an example?

Thanks.

Art



Quote:
> Pass it as an object instead.

> Can't pass strings, as you're finding out, in the world of wwww.
Everything
> is defined as variant.



> > I'm writing a web service function in which I'd like to return a
> > multidimensional array.  Single dimension arrays are easy:
> >     <WebMethod()>Public Function ArrayTest() As String()
> >         dim b(2) as String
> >         b(0)="abc"
> >         b(1)="def"
> >         return b
> >     End Function

> > But I can't figure out the declaration syntax to return a
multidimensional
> > array.  I've been everywhere in the books and on the web but this is
> nowhere
> > to be seen. I've tried all sorts of variations. Most won't compile.
Those
> > that do return errors at runtime.

> > Thanks.

> > Art



Tue, 26 Jul 2005 00:44:31 GMT  
 How to declare function to return multidimensional array
Sure:

Public Function PassTheBucks(Whatever as Whatever)as Object

Let's say we have 19 items

Dim MyArray(20)

Fill the Array
MyArray(0) = "Hello"
Send it on its merry way

MyFunction = MyArray

End Funtion

hth


Quote:
> Could you give me a simple example or a pointer to an example?

> Thanks.

> Art



> > Pass it as an object instead.

> > Can't pass strings, as you're finding out, in the world of wwww.
> Everything
> > is defined as variant.



> > > I'm writing a web service function in which I'd like to return a
> > > multidimensional array.  Single dimension arrays are easy:
> > >     <WebMethod()>Public Function ArrayTest() As String()
> > >         dim b(2) as String
> > >         b(0)="abc"
> > >         b(1)="def"
> > >         return b
> > >     End Function

> > > But I can't figure out the declaration syntax to return a
> multidimensional
> > > array.  I've been everywhere in the books and on the web but this is
> > nowhere
> > > to be seen. I've tried all sorts of variations. Most won't compile.
> Those
> > > that do return errors at runtime.

> > > Thanks.

> > > Art



Wed, 27 Jul 2005 01:45:55 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Declaring a Public Function that returns a Dynamic String Array

2. Declaring multidimensional dynamic arrays

3. Declaring a dynamic Multidimensional array?

4. Multidimensional Array returned from COM object

5. Multidimensional, multidimensional arrays

6. Array in array returned by function

7. declaring a function that returns a custom type

8. Help declaring functions returning structs?

9. Change Array to Multidimensional Array

10. Is there a way to declare an array of subs or functions

11. Return entire array from a function

12. returning an array from a function

 

 
Powered by phpBB® Forum Software