Re: why doesn't this compile

Tech-Archive recommends: Fix windows errors by optimizing your registry




Public Property Get foo() As String()
foo = foo1
End Property

Above, you are returning an array

Dim s As String
s = fooList(0).foo(0)

Above, foo return array, but s is just a string.

Also... your foo prperty takes no parameters, but in
the above snippet you are passing a 0 (zero) to foo.

Dim fooList(0 To 6) As Class1


Above you dim the array of classes, but where do you
"set fooList(0) = new Class1" it?

later
Saga


"Andy Fish" <ajfishNON@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23ssj2QmhGHA.204@xxxxxxxxxxxxxxxxxxxxxxx
create a new class called Class1 with the following

Option Explicit
Private foo1() As String
Public Property Get foo() As String()
foo = foo1
End Property

this creates a class with a public property which is an array of strings, correct?

so why does this not compile?

Dim fooList(0 To 6) As Class1
Dim s As String
s = fooList(0).foo(0)

it gives "wrong number of arguments or invalid property assignment"

whereas this works fine

Dim ss() As String
ss = fooList(0).foo
s = ss(0)

I'm mystified

Andy




.



Relevant Pages

  • Re: Returning a string array from a function
    ... I'd like to return an string array from a function so ... E.g. "total" only gets found out inside foo. ... to avoid storing past the end of the sptr[] array if `total' ...
    (comp.lang.c)
  • Re: String to array as command line
    ... ARGV array variable. ... def command_line string ... p command_line(' foo bar foobar ') ...
    (comp.lang.ruby)
  • Re: How do I get a String[] from a Map keys ?
    ... not possible to cast an Object down to a String. ... How can I do to have an array of strings from the foo map key set? ... Revisit the API and you'll find that the Set method toArray() explicitly ...
    (comp.lang.java.programmer)
  • Re: String parsing?
    ... I am trying to parse ... a string into an array. ... Array= foo ...
    (comp.lang.ruby)
  • Re: not sure if there is an easy way to do this!
    ... the type you said you were using for your keys (I realize the name is likely something other than Foo). ... You don't use anything for "foo1" and "foo2"...those are the parameters for the delegate and the Sort method passes in actual values. ... That "groups of five" array is not useful for anything, because there's no practical way to use the .NET functionality to do anything with it. ...
    (microsoft.public.dotnet.languages.csharp)