Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 21, 2011 05:24 AM by sendtosree
Member
20 Points
23 Posts
Dec 19, 2011 09:36 PM|LINK
Was wondering if you could help me how to convert an ArrayList to Object.
If I have the following: Dim errorArray() As Object Dim errorList As ArrayList
How do I convert errorList to errorArray() in VB.Net? Thank you.
356 Points
77 Posts
Dec 19, 2011 09:42 PM|LINK
You can use this code!
Dim errorArray() As Object = errorList.ToArray();
Dec 19, 2011 09:53 PM|LINK
@kamanashish thanks for your quick reply. Another question. How to I convert a specific record from the errorList to an Object using the given above. For example: For i As integer = 0 To errorList.Count - 1 Dim errorArray() As Object = errorList(i) ?????? [ ToArray is NOT AVAILABLE ] Next Thank you everyone.
Dec 19, 2011 10:05 PM|LINK
devtekguy Dim errorArray() As Object = errorList(i) ?????? [ ToArray is NOT AVAILABLE ]
errorList(i) is an item of list. You can not convert one item to array.
Dec 19, 2011 11:24 PM|LINK
@kamanashish... thanks again. Ok, how about this.
Dim obj As Object Dim array() As Object How do I convert obj to array()?
Any sugguestions? Thanks.
Dec 20, 2011 08:41 AM|LINK
devtekguy How do I convert obj to array()?
I think you want to add this obj as an item to the object array...
Dim obj as Object Dim arr(100) As Object arr(0) = New Object() arr(1) = obj arr(2) = 7 arr(3) = "Hello"
You can insert any item like this.
Participant
874 Points
201 Posts
Dec 21, 2011 05:24 AM|LINK
i think this may help you . If not please explain your scenario more clearly
For i As Integer = 0 To errorList.Count - 1 errorArray(i) = errorList(i) Next
devtekguy
Member
20 Points
23 Posts
How to convert? ArrayList to Object
Dec 19, 2011 09:36 PM|LINK
Was wondering if you could help me how to convert an ArrayList to Object.
If I have the following:
Dim errorArray() As Object
Dim errorList As ArrayList
How do I convert errorList to errorArray() in VB.Net? Thank you.
kamanashish
Member
356 Points
77 Posts
Re: How to convert? ArrayList to Object
Dec 19, 2011 09:42 PM|LINK
You can use this code!
Kamanashish
Microsoft Certified Professional (MCP)
Mark Post As Answer If you Get Help From It.
devtekguy
Member
20 Points
23 Posts
Re: How to convert? ArrayList to Object
Dec 19, 2011 09:53 PM|LINK
@kamanashish thanks for your quick reply. Another question.
How to I convert a specific record from the errorList to an Object using the given above.
For example:
For i As integer = 0 To errorList.Count - 1
Dim errorArray() As Object = errorList(i) ?????? [ ToArray is NOT AVAILABLE ]
Next
Thank you everyone.
kamanashish
Member
356 Points
77 Posts
Re: How to convert? ArrayList to Object
Dec 19, 2011 10:05 PM|LINK
errorList(i) is an item of list. You can not convert one item to array.
Kamanashish
Microsoft Certified Professional (MCP)
Mark Post As Answer If you Get Help From It.
devtekguy
Member
20 Points
23 Posts
Re: How to convert? ArrayList to Object
Dec 19, 2011 11:24 PM|LINK
@kamanashish... thanks again. Ok, how about this.
Dim obj As Object
Dim array() As Object
How do I convert obj to array()?
Any sugguestions? Thanks.
kamanashish
Member
356 Points
77 Posts
Re: How to convert? ArrayList to Object
Dec 20, 2011 08:41 AM|LINK
I think you want to add this obj as an item to the object array...
You can insert any item like this.
Kamanashish
Microsoft Certified Professional (MCP)
Mark Post As Answer If you Get Help From It.
sendtosree
Participant
874 Points
201 Posts
Re: How to convert? ArrayList to Object
Dec 21, 2011 05:24 AM|LINK
i think this may help you . If not please explain your scenario more clearly
For i As Integer = 0 To errorList.Count - 1 errorArray(i) = errorList(i) NextSree
Mark as Answer if it helps