0

我正在尝试在另一种类型中使用一种类型,但它不允许我这样做。

Public Type MyTable
     Name As String
     IDStartingNumber As Integer
     Items(50) As MyItem
End Type

Public Type MyItem
    Name As String
    DataType As DataTypes
    Number As Integer
    AllowNull As Boolean
    Unique As Boolean
    Reference As MyTable
End Type

发生了什么事,我该如何解决?

4

2 回答 2

5

确保您引用的类型在它之前。在您的示例中,您之后有 MyItem 类型。例如:

Public Type MyItem
    Name As String
    DataType As DataTypes
    Number As Integer
    AllowNull As Boolean
    Unique As Boolean
    Reference As MyTable
End Type

Public Type MyTable
     Name As String
     IDStartingNumber As Integer
     Items(50) As MyItem
End Type
于 2013-07-07T02:45:50.417 回答
0

在这两个示例中,似乎一种类型引用了另一种类型,因此这两个示例都不适用。

IE

公共类型 MyTable Name As String IDStartingNumber As Integer Items(50) As MyItem End Type

公共类型 MyItem Name As String DataType As DataTypes Number As Integer AllowNull As Boolean Unique As Boolean Reference As MyTable End Type

您不能让一个类型引用另一种类型,而后者又引用第一种类型。

于 2019-01-29T15:38:57.343 回答