Consulting

Results 1 to 13 of 13

Thread: How to Pass an array of implement(ed) object(s) to a sub/function?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Aug 2015
    Posts
    8
    Location

    How to Pass an array of implement(ed) object(s) to a sub/function?

    Class - NamedData
    public property get Name() as string
    end property
    public property let Name(value as string)
    end property
    
    Class - ProperName
    implements NamedData
    private Name as string
    private property get NamedData_Name() as string
        NamedData_Name = Name
    end property
    private property let Name(value as string)
        Name = value
    end property
    public property get Name() as string
        Name = NamedData_Name
    end property
    public property let Name(value as string)
        NameData_Name = value
    end property
    
    ThisDocument
    dim ProperNames(10) as new ProperName
    
    dim sub xMain()
          LoadNamedData(ProperNames)  ' ByRef Argument Type Mismatch !!!
    end  sub
    
    Sub LoadNamedData(oND() as NamedData)
        ' do stuff
    end sub
    Why am I getting the type mismatch when ProperNames is any array of NamedData (by way of implements)? This also doesn't work if it's not an array. But it does work if byval is used but only for non array.
    Last edited by WallyZ; 02-08-2016 at 12:41 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •