# Reading and Writing  array of Rapid

**URL:** <https://tech-community.robotics.abb.com/t/reading-and-writing-array-of-rapid/2290>\
**Category:** Developer Tools\
**Created:** [November 13, 2008, 2:06am UTC](https://tech-community.robotics.abb.com/t/reading-and-writing-array-of-rapid/2290 "2008-11-13T02:06:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [November 13, 2008, 2:06am UTC](https://tech-community.robotics.abb.com/t/reading-and-writing-array-of-rapid/2290/1 "2008-11-13T02:06:55Z")

</div>

Hi,  
How can I read and modify the array of Rapid in [VB.net](http://VB.net). My reading array program as folllows:  
Dim RD As RapidData = Me.controller.Rapid.GetRapidData(“T\_ROB1”, “MainModule”, “array1”)  
If RD.IsArray Then  
Dim AD As ArrayData = DirectCast(RD.Value, RapidDomain.ArrayData)  
Dim ASum As Double = 0.0R  
Dim ANum As RapidDomain.Num  
For I As Integer = 1 To AD.Length  
ANum = DirectCast(AD(I - 1), Num)  
ASum += DirectCast(ANum.Value, Double)  
Next  
ANum = DirectCast(RD.ReadItem(1, 1), Num)  
I define the array in Rapid as “PERS num array1{2}:=[50,60];”  
The program can not work , the error is “An argument specified by the client is not valid for this type of operation.” to the instruction “ANum = DirectCast(RD.ReadItem(1, 1), Num)”  
How Can I do? Thanks everyone

---

<div class="post-metadata">

**Author:** ![RussD](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@RussD](https://tech-community.robotics.abb.com/u/RussD)\
**Post date:** [November 13, 2008, 9:58pm UTC](https://tech-community.robotics.abb.com/t/reading-and-writing-array-of-rapid/2290/2 "2008-11-13T21:58:13Z")

</div>

Shouldn’t you use ReadItem(i) instead?

You only have a 1-d array, also I think a RapidData object will be 0-based, while the RAPID ArrayData would be 1-based.
