作者CuckooBoy (书仔)
看板Visual_Basic
标题Re: [VB6 ] 读取txt
时间Sat Jun 28 15:36:09 2008
※ 引述《a9 (a9)》之铭言:
: ※ 引述《CuckooBoy (书仔)》之铭言:
: : 照书demo打,执行说.....a$ 找不到方法或成员??
: : 哪边有错呢?
: : 高手可以推一把吗?>"<
: : Private Sub Form_Load()
: : Open App.Path & "\Backup.ini" For Output As #1
: : Line Input #1, a$
: : Title.txt = a$
: : Close #1
: : End Sub
: Dim f as Integer,sLine As String
: f=FreeFile '取得一个可用的档案代码
: Open App.Path & \"Backup.ini" For Input As #f '用Input方式开档
: While Not EOF(f) '如果还没到档尾
: Line Input #f,sLine '读取一行
: '做你要做的事
: Wend
: Close#f '关档
: 如果只要读一行
: If Not EOF(f) Then Line Input #f,sLine
Private Sub Form_Load()
Dim f, cnt As Integer, titledata, autherdata As String
f = FreeFile
Open App.Path & "\Backup.ini" For Input As #f
While Not EOF(f)
Line Input #f, Data
cnt = cnt + 1
Select Case cnt
Case 1
Title.Text = Data
Case 2
Auther.Text = Data
Case 3
Time.Text = Data '时间来源
Case 4
Item1.Text = Data '项目1来源
Case 5
Item2.Text = Data '项目2来源
Case 6
Item3.Text = Data '项目3来源
Case 7
Item4.Text = Data '项目4来源
End Select
Wend
Close #f
End Sub
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.195.194.110
1F:→ MrOrz:其实行数(这里即为资料数)固定,可以不用硬用回圈。 06/28 18:53