"Cowboy (Gregory A. Beamer) - MVP" <> wrote
in message news:9745B80A-03ED-4FC7-8294-...
> For your single operation, you can do something like this:
>
> Dim cc As New DataSourceCredentials
> Dim cred() As DataSourceCredentials = {cc}
> cred(0).DataSourceName = "198.87.87.6"
> cred(0).Password = "XXX"
> cred(0).UserName = "YYY"
>
> This is largely useless, but avoids the compile error. If you are going to
> pop Credentials on and off the collection, you are better to set up cred
as a
> collection rather than a simple array.
>
> You can also do something like:
> Dim cred(1) As DataSourceCredentials
> Dim cc As New DataSourceCredentials
> cred(0) = cc
> cred(0).DataSourceName = "198.87.87.6"
> cred(0).Password = "XXX"
> cred(0).UserName = "YYY"
>
> And Redim for additional values, remember to use Preserve to avoid
clearing
> out the initial values. You biggest isssue is there is no size to your
array.
> In the first example, the size is implicitly set to 1; in the second it is
> explcitly set.
just a minor correction..in the second case, size is explicitly to 2 -
cred(0) will set the size to 1..apart from that all's good
Imran.