Use the search and browse feature to view Kepware's repository of more than 500 Knowledge Base articles. Narrow your results or type your query into the search field below.

Search Solutions Results By: View All Solutions

Kepware Knowledge Base: Solution


Unable to Read a Multi-Dimensional Array from an OPC Server in VB.Net


Last Update: 11/7/2018

Problem:
This issue only applies to ClientAce projects written in VB.Net.

  • In ClientAce V1.0, a server item returned a two-dimensional array of data, but the item's Value Variable cannot be parsed.
  • In ClientAce V3.5, a server item returned a two-dimensional array of data, but the item's Value Variable is not in the correct array format.
  • In ClientAce V4.0, a server item returned a two-dimensional array of data, but the item's Value Variable is not in the correct array format.

Possible Cause:
The issue results from the way that VB.Net sees the SafeArray being passed from the unmanaged communication code layer to the .Net layer. Projects written with C# will not have problems.

Solution:
For the purpose of this explanation, the example array from the server will be a 2x5 array configured with the the following values:

01234
56789

1. For projects written against ClientAce V1.0, the array is unrecognizable. The best solution for users developing with this version is to upgrade to ClientAce V3.5 or V4.0.
2. In ClientAce V3.5 projects, the row and column indices are reversed to be 5x2, with the values appearing as follows:

01
23
45
67
89

3. In ClientAce V4.0 projects, the array is again reversed but the element values are presented as follows:

05
16
27
38
49

Note: As long as developers are aware of the Microsoft limitations, the array data can be processed.

Related Products
ClientAce