标题:照书上打下来的,但报错说实时错误'424',要求对象
只看楼主
cosixu
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2004-10-11
 问题点数:0 回复次数:1 
照书上打下来的,但报错说实时错误'424',要求对象
Type recordtype
name As String
age As Integer
tel As String
End Type

Dim number As Integer
Dim recordw As recordtype
Private Sub Form_click()
Open "e:\tel.txt" For Random As #1 Len = Len(recordw)
number = LOF(1) / Len(recordw)
enter = Chr$(13) + Chr$(10)
msg$ = "1.建立文件"
msg$ = msg$ + enter + enter + "请选择操作"
resp = InputBox(msg$)
Select Case resp
       Case 1
         file_write
End Select
End Sub

Sub file_write()
Do
  recordw.name = InputBox$("enter name")
  recordw.age = InputBox("enter age")
  recordw.tel = InputBox$("enter tel")
  number = number + 1
  Put #1, number, recordw
Loop Until recordw.name = "done"
End Sub

请教一下为什么会出错?
搜索更多相关主题的帖子: 实时 对象 
2005-05-31 11:51
cosixu
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2004-10-11
得分:0 
下午翻了一下书,总算看出来了!
原来随机文件要有定长才行,唉,去了一上午
Type recordtype
name As String*10
age As Integer
tel As String*15
End Type
 string后面不加数超为128计算机不认识了,唉,可怜耽误一个上午!
请和我一样范同样错误的人注意呀!!!!
2005-05-31 13:09



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




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

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