title: How can I get one dimension from a bi-dimensional array in VB.Net?
body: <p>I have an application in VBA that gives to my VB.Net dll one bi-dimensional variant. It is a an array, in which every component is a another array containing two positions.</p>
  
  <p>I want to get this two-position array. When I am using VBA I can access directly the data from each position by doing:</p>
  
  <pre><code>dataArray(index, 0) or dataArray(index, 1)
  </code></pre>
  
  <p>And when I want to get the two-position array I can use:</p>
  
  <pre><code>Dim posArray as variant
  posArray = dataArray(index)
  </code></pre>
  
  <p>posArray(0) contains dataArray(index, 0) and posArray(1) contains dataArray(index, 1).</p>
  
  <p>But when I am using VB.Net, I can access directly the data, just like the first example. However, when I try to get one dimension from the two-dimension array, like I did in the second example, it is not possible.</p>
  
  <pre><code>Dim posArray as Object
  posArray = dataArray(index)
  </code></pre>
  
  <p>It says "Attempted to operate on an array with the incorrect number of dimensions."</p>
  
  <p>I have tried everything to make it work, and I don't want to make the attribution one by one, like:</p>
  
  <pre><code>posArray(0) = dataArray(index, 0)
  posArray(1) = dataArray(index, 1)
  </code></pre>
  
  <p>Thank you for the help.</p>