Connecting Tech Pros Worldwide Forums | Help | Site Map

Use CType to Convert Array

Jarod_24
Guest
 
Posts: n/a
#1: Nov 20 '05
Structure myXMLtype
Dim Filename As String
Dim sql As String
End Structure
....

Dim obj as New ArrayList
......

return CType(obj.ToArray, myXMLtype) 'This wont work

I know that CType() can't be used to convert a Array into a array of another type but is there any other method that will to do this
without having to create another array, and then do a loop where you convert each element?




Ken Tucker [MVP]
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Use CType to Convert Array


Hi,

Take a look at the arraylist's copyto method.
http://msdn.microsoft.com/library/de...opytotopic.asp

Ken
----------------------
"Jarod_24" <jarod_24@hotmail.com> wrote in message
news:f4262ae93d9803ae570e1efa7e5dbc92@news.teranew s.com...[color=blue]
> Structure myXMLtype
> Dim Filename As String
> Dim sql As String
> End Structure
> ...
>
> Dim obj as New ArrayList
> .....
>
> return CType(obj.ToArray, myXMLtype) 'This wont work
>
> I know that CType() can't be used to convert a Array into a array of[/color]
another type but is there any other method that will to do this[color=blue]
> without having to create another array, and then do a loop where you[/color]
convert each element?[color=blue]
>
>
>[/color]


Ken Tucker [MVP]
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Use CType to Convert Array


Hi,

Take a look at the arraylist's copyto method.
http://msdn.microsoft.com/library/de...opytotopic.asp

Ken
----------------------
"Jarod_24" <jarod_24@hotmail.com> wrote in message
news:f4262ae93d9803ae570e1efa7e5dbc92@news.teranew s.com...[color=blue]
> Structure myXMLtype
> Dim Filename As String
> Dim sql As String
> End Structure
> ...
>
> Dim obj as New ArrayList
> .....
>
> return CType(obj.ToArray, myXMLtype) 'This wont work
>
> I know that CType() can't be used to convert a Array into a array of[/color]
another type but is there any other method that will to do this[color=blue]
> without having to create another array, and then do a loop where you[/color]
convert each element?[color=blue]
>
>
>[/color]


Closed Thread