标题:[求助]关于在txt中存放数据的问题。。
取消只看楼主
aasd5
Rank: 1
等 级:新手上路
帖 子:57
专家分:0
注 册:2006-4-24
 问题点数:0 回复次数:1 
[求助]关于在txt中存放数据的问题。。
模块Module1
Type guest
strName As String * 8
blnSex As Boolean
byaAge As Byte
strCompany As String * 40
strTitle As String * 20
strRoom As String * 4
dtmIn As Data
dtmOut As Data
blnIsIn As Boolean
End Type
五个窗体
在一个窗体中
Private Sub cmdAdd_Click()
Dim NewGuest As guest
Dim int1 As Integer
If Len(Trim(CStr(txtName.Text))) = 0 Then
MsgBox ("必须输入姓名")
Exit Sub
End If
NewGuest.blnIsIn = True
NewGuest.blnSex = optMale.Value
NewGuest.byaAge = CInt(txtAge.Text)
NewGuest.dtmIn = Now
NewGuest.strCompany = txtCompany.Text
NewGuest.strName = txtName.Text
NewGuest.strTitle = cboTitle.Text
NewGuest.strRoom = cboRoom.Text
If Dir(strGuestNum) = "" Then
int1 = 0
Else
Open strGuestNum For Input As 1
Input #1, int1
Close 1
End If
Open strGuestNum For Output As 1
Write #1, int1 + 1
Close 1
Open strGuestData For Random As 1 Len = Len(NewGuest)
Put 1, int1 + 1, NewGuest
Close 1
For int1 = 0 To cboTitle.ListCount - 1
If Trim(cboTitle.Text) = Trim(cboTitle.List(int1)) Then
Exit For
End If
Next
If int1 = cboTitle.ListCount Then
Open strTitle For Append As 1
cboTitle.AddItem Trim(cboTitle.Text)
Write #1, Trim(cboRoom.Text)
Close 1
End If
ClearControl
End Sub

运行时出错
行:Open strGuestData For Random As 1 Len = Len(NewGuest)
Put 1, int1 + 1, NewGuest

编译错误:
不能Get或Put一个对象引用变量或包含对象引用的用户定义类型

请问错在哪里,应如何修改呢?谢谢了
搜索更多相关主题的帖子: txt 数据 
2007-11-11 18:11
aasd5
Rank: 1
等 级:新手上路
帖 子:57
专家分:0
注 册:2006-4-24
得分:0 

额,谢谢楼上的两位。。。我试试。。


2007-11-12 10:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-185289-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.141083 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved