-1

我有一个返回数组的 javascript

var docArray = new Array(page, stamprect[0], stamprect[3], stamprect[2], stamprect[1],     srot);
return docArray;

我正在尝试让 VB.Net 将其读入数组

Dim stampInfo() As Integer
stampInfo = javaScriptObj.getAllGhostStamps(CInt(pages.Item(i)) - 1)

我收到错误:

Unable to cast object of type 'System.Object[]' to type 'System.Int32[]'.

我不知道如何将其类型转换为数组。任何帮助,将不胜感激。谢谢

4

1 回答 1

1

您需要将数组中的每个项目转换为整数。例如:

Dim raw() As Object = javaScriptObj.getAllGhostStamps(CInt(pages.Item(i)) - 1)
Dim stampInfo(raw.Length) As Integer
For i As Integer = 0 to raw.Length - 1
    stampInfo(i) = CType(raw(i), Integer)
Next
于 2012-05-16T12:16:48.863 回答