# Output Array as Argument in InvokeCode Activity

**URL:** <https://forum.uipath.com/t/output-array-as-argument-in-invokecode-activity/220264>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [May 6, 2020, 1:21am UTC](https://forum.uipath.com/t/output-array-as-argument-in-invokecode-activity/220264 "2020-05-06T01:21:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaBOT](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@DaBOT](https://forum.uipath.com/u/DaBOT)\
**Post date:** [May 6, 2020, 1:21am UTC](https://forum.uipath.com/t/output-array-as-argument-in-invokecode-activity/220264/1 "2020-05-06T01:21:09Z")

</div>

I have declared an output argument in an InvokeCode activity as “OutputInt” with type “System.Int32” But I cannot reference that array in the [vb.net](http://vb.net) code without throwing an error. Like this…

Dim i As Integer  
For i = 1 To Limit  
OutputInt(i) = i  
Next i

Limit is a simple input argument with type Int32. That works fine.

I’ve tried putting reDim OutputInt(50) and Dim OutputInt(50) into the code, but that doesn’t work (already declared or reDim not allowed.

Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [May 6, 2020, 4:35am UTC](https://forum.uipath.com/t/output-array-as-argument-in-invokecode-activity/220264/2 "2020-05-06T04:35:59Z")

</div>

@DaBOT I guess you can try with List(Of Int32) , Since arrays need to be assigned with Size, it might throw an error in your case, Since you’re directly assigning values to the Array.

---

<div class="post-metadata">

**Author:** ![DaBOT](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@DaBOT](https://forum.uipath.com/u/DaBOT)\
**Post date:** [May 6, 2020, 11:46am UTC](https://forum.uipath.com/t/output-array-as-argument-in-invokecode-activity/220264/3 "2020-05-06T11:46:07Z")

</div>

Thanks for the suggestion, but it didn’t work. My workaround is to 1) declare and initialize a second array variable in the general workflow, 2) change the InvokeCode array declaration to an In/Out argument, and 3) set the Value of the In/Out array argument to the general workflow array. I can tell that the InvokeCode is changing values in the array which is what I want.
