| 发表于:2007-02-09 19:44:358楼 得分:0 |
终于得到自己想要的结果了,谢谢上面对面几位大侠的大力帮助!下面贴出的就是完整的程序,希望对和我一样被类似问题困扰的朋友有所帮助。 dim str1 as string dim str2 as string private sub command1_click() open "c:\test1.txt " for input as #1 '打开文件 open "c:\test3.txt " for output as #3 '打开文件 do while not eof(1) '如果指针不是指向文件结尾,则执行循环 line input #1, str1 '读取文件内容并将值赋给变量str1 call compare '调用compare过程 loop close #1 close #3 end sub private sub command2_click() unload me end sub private sub compare() open "c:\test2.txt " for input as #2 do while not eof(2) line input #2, str2 if strcomp(trim(str1), trim(str2), vbtextcompare) = ture then '调用strcomp函数,对读取的数据进行判断 print #3, str2 '如果符合判断条件则在test3中写入数据 end if loop close #2 end sub | | |
|