Dim s As String, fnr As Integer
fnr=freefile
Open "C:\semcitpgrouporiginal\button" & buttonnumber & "list.txt" For Input As #fnr
Do Until EOF(fnr)
Line Input #fnr, s
List1.AddItem s
Loop
Close #fnr
上面是我将文本文件的内容逐行写入数组的程序,
如果我用BOF来判断文本文件内容是否为空时,就会报“函数未定义”的错误。具体程序如下:
dim i as integer
i=0
Open "C:\semcitpgrouporiginal\button" & buttonnumber & "list.txt" For Input As #fnr
do until BOF(fnr)
i=i+1
loop
close #fnr
if i=1 then
text1.text=" there's no item"
end if