private sub command1_click()open "c:\tm.txt" for input as #1line input #1,sif right(s,1)="=" then msgbox "输出为空"else msgbox right(s,1)end ifclose #1end sub1、对于文件的操作vb提供了open语句、print #语句、input #语句等语句来处理文件。2、读取多行文本,可以使用line input #语句,一行行读取,再连接在一起,这种方法对大一点txt文件效率不高。3、下面提供一个高效率、一次性读入所有文本的vb6示例:private sub command1_click() dim r open "d:\readme.txt" for binary as #1 r = strconv(inputb(lof(1), 1), vbunicode) close #1 debug.print rend subdim s as stringopen "\tm.txt" for input as #1input #1,sif right(s,1)="=" then msgbox "输出为空"else msgbox right(s,1)end ifclose #1On Error Resume Next Dim another As String Open "c:\tm.txt" For Input As #1 Do While Not EOF(1) Input #1, another Close #1 if mid(another,3,1) is not null then a=mid(another,3,1) msgbox aelse msgbox "输出为空"end if