# Re: 如何从一个文字档中检查字串...

Posted by Cloud on December 21, 1998 at 10:35:58:

In Reply to: 如何从一个文字档中检查字串... posted by 天定.... on December 17, 1998 at 22:29:24:

1.建议你将这个文字档案改成 *.mdb, 找资料会快 N 倍
2.如果还是一定要用文字档做, 必须只开一次档案, 然后
这又有几种不同的做法:
Dim sGet As String, lFile As Long
Open App.Path & "\data.txt" For Binary As #1
lFile = LOF(1)
sGet = Space(lFile)
Get #1,, sGet

a. Dim vArr(0 To 2) As Variant 来 parse sGet
这个字串
b. 把文字档格式改成:
Account = 1, Password = AAA, Score = 85
Account = 2, Password = BBB, Score = 88
...
sGet 取得此文字档内容时, 再用
InStr(sGet, "Account = " & Text1.Text)
这样比法 a 快

Follow Ups: