VB 数据类型
问题:
我在模块里定义如下:
Public Type ObsVal P1 As Double 'L1上的P码伪距End TypePublic Type XYZRS rx As Double ry As Double rz As DoubleEnd TypePublic Type O_Data data() As ObsVal ComSateRS() As XYZRSEnd TypePublic Type Ofile LiYuan() As O_DataEnd TypePublic Odata1 As Ofile
for i = 1 to 10 For j = 1 To n Odata1.LiYuan().ComSateRS(j).rx = 3 Next jnenxt i
for i = 1 to 10 For j = 1 To n 4=Odata1.LiYuan().data(j).P1 Next j next i
Public Type abc a() As IntegerEnd TypePublic Type ccc a As abcEnd TypePrivate Sub Form_Load()Dim xx As cccReDim xx.a.a(0 To 2)Debug.Print xx.a.a(1)End Sub
[解决办法]
自定义类型里,使用动态数组,那么你必须在使用动态数组前,进行分配单元
Private Sub Command2_Click()
dim A as O_Data
redim a.data(100)
redim a.ComSateRS(20)
end sub