我试着定义了这么个类型
private type customtype
a1 as integer
a2 as integer
a3 as integer
end type
private type TypeT
typss() as customtype
num as integer
end typedim df() as typetredim df (0) as typet
redim df(0).typss(0) as customtype
到这里都不报错
可是要用df(0).typss(0).a1=1
时就报错,具体这样的一个数据怎么传递叻?
private type customtype
a1 as integer
a2 as integer
a3 as integer
end type
private type TypeT
typss() as customtype
num as integer
end typedim df() as typetredim df (0) as typet
redim df(0).typss(0) as customtype
到这里都不报错
可是要用df(0).typss(0).a1=1
时就报错,具体这样的一个数据怎么传递叻?
解决方案 »
- 利用VB采集部分网页数据
- 请问如何使用case语句完成下列表达
- 大虾们能不能给我说下怎么使用视频卡开发监控系统?
- 标准com组件的问题
- 如何设置msflexgrid,使其当选中这行中的任何一列时,让这行变色。
- 各位给看一下!诸位大虾帮我快!!!!!!!!!
- 我刚来,分少但我真诚的希望大家帮助我!我可以清囊!关于php->VB的问题!
- 谁来帮我解决一下啊???有VB达人吗??????
- ASP翻页突发错误,头痛,请求各位大虾帮助!!!
- 关于 TreeView 控件里图标的问题
- 怎样调用其他窗口的command对象?
- 为什么用户在重装糸统前可以用我的软件,而重装后就提示Comdlg32.ocx outdated
a1 As Integer
a2 As Integer
a3 As Integer
End Type
Private Type TypeT
typss() As customtype
num As Integer
End Type
Private Sub Command1_Click()
Dim df() As TypeT
ReDim df(0)
ReDim df(0).typss(0)
df(0).typss(0).a1 = 1
df(0).typss(0).a2 = 2
df(0).typss(0).a3 = 3MsgBox df(0).typss(0).a2
End Sub
只用到這個語句就夠了 ﹕redim df (0) as typet
a1 as integer
a2 as integer
a3 as integer
end type
private type TypeT
typss() as customtype
num as integer
end type因為TypeT是有兩個屬性typss﹑num,而typss又有它的子屬性a1,a2,a3
所以你重新定義的時候只需要重新定義TypeT就夠了這就相當于C里面講到的類的繼承問題
Private Type customtype
a1 As Integer
a2 As Integer
a3 As Integer
End Type
Private Type TypeT
typss() As customtype
num As Integer
End TypePrivate Sub Command1_Click()
Dim df() As TypeTReDim df(0) As TypeT
ReDim df(0).typss(0) As customtype df(0).typss(0).a1 = 1
MsgBox df(0).typss(0).a1End Sub