private type xxx
a as string
b as string
c as string
end type
dim m_data(10) as xxx
m_data(.)..... 初始化
然后怎么把m_data 保存到 c:\123data.dat
下次再 读到 m_data 中!怎么弄?
VB 保存自定义结构数组到文件
答案:1 悬赏:50 手机版
解决时间 2021-01-29 10:36
- 提问者网友:送舟行
- 2021-01-28 21:06
最佳答案
- 五星知识达人网友:风格不统一
- 2021-01-28 21:26
Private Type xxx
a As String
b As String
c As String
End Type
Private Sub Form_Load()
Dim m_data(10) As xxx
Dim m_data1(10) As xxx
'测试
For n = 0 To 10
m_data(n).a = n
m_data(n).b = n
m_data(n).c = n
Next
'写入
Open "c:\123data.dat" For Binary As #1
Put #1, 1, m_data
Close #1
'读取
Open "c:\123data.dat" For Binary As #1
Get #1, 1, m_data1
Close #1'
'测试读取
MsgBox UBound(m_data1)
MsgBox m_data1(UBound(m_data1)).a
End Sub
a As String
b As String
c As String
End Type
Private Sub Form_Load()
Dim m_data(10) As xxx
Dim m_data1(10) As xxx
'测试
For n = 0 To 10
m_data(n).a = n
m_data(n).b = n
m_data(n).c = n
Next
'写入
Open "c:\123data.dat" For Binary As #1
Put #1, 1, m_data
Close #1
'读取
Open "c:\123data.dat" For Binary As #1
Get #1, 1, m_data1
Close #1'
'测试读取
MsgBox UBound(m_data1)
MsgBox m_data1(UBound(m_data1)).a
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯