Reputation: 483
I am trying to assign values of array to a string, following is the code:
oDocument1.IdentifierCode = lstFundIdentifiers.ToArray()
where IdentifierCode is a string while lstFundIdentifiers is declared as
ByVal lstFundIdentifiers As List(Of String).
I am not sure as to what is going wrong.
Upvotes: 0
Views: 9077
Reputation: 13795
String <> String()
Trying to assign an array to a string is like trying to put 4 tires on a unicycle. An array (or list) is a collection of objects, in your case, strings.
You can do this: yourArray(1) = yourString
or yourString = yourArray(0)
, but you can't do this: yourString = yourArray
.
"So previously it was something like this oDocument.FundServCodes = lstFundServCodes.ToArray()"
FundServCodes is an array itself, which is why that would work. You can easily confirm this by going to the class and looking at the FundServCodes property.
These are basic programming concepts. Maybe you should go read up on collections, data types, objects, etc. There are 1000's of programming books and tutorials for all skill levels out there. Look one up and go through it.
Upvotes: 2