没有实战过VB,但最近帮一个朋友写一个小程序,指定用VB编程,比较郁闷,从头学起,现遇到一问题,请高手解答,谢谢!
问题描述:使用Do While Not EOF(1)不能正确判断文件结尾,程序无法退出循环.
代码如下:
写文件代码:Open (Trim(Text1.Text)) For Output As #1
strSqlTmp = "select * from XD order by F154, F1 desc"
resForm20.Open strSqlTmp, cnn, adOpenKeyset, adLockOptimistic
If resForm20.RecordCount > 0 Then
For i = 1 To nXuandiao
strOutputLine = ""
Set ITM = ListView1.ListItems(i)
If ITM.Checked = True Then
strOutputLine = "XD"
For j = 1 To 155
strOutputLine = strOutputLine & "$" & resForm20.Fields(j).Value
Next j
Print #1, strOutputLine & "$"
End If
resForm20.MoveNext
Next i
End If
Close #1
读出代码:
Open Text1.Text For Input As #2
iCol = 0
iNumber = 0
Do While Not EOF(1)
strTextLineInput = ""
Line Input #2, strTextLineInput
' 相关处理
Loop
问题描述:使用Do While Not EOF(1)不能正确判断文件结尾,程序无法退出循环.
代码如下:
写文件代码:Open (Trim(Text1.Text)) For Output As #1
strSqlTmp = "select * from XD order by F154, F1 desc"
resForm20.Open strSqlTmp, cnn, adOpenKeyset, adLockOptimistic
If resForm20.RecordCount > 0 Then
For i = 1 To nXuandiao
strOutputLine = ""
Set ITM = ListView1.ListItems(i)
If ITM.Checked = True Then
strOutputLine = "XD"
For j = 1 To 155
strOutputLine = strOutputLine & "$" & resForm20.Fields(j).Value
Next j
Print #1, strOutputLine & "$"
End If
resForm20.MoveNext
Next i
End If
Close #1
读出代码:
Open Text1.Text For Input As #2
iCol = 0
iNumber = 0
Do While Not EOF(1)
strTextLineInput = ""
Line Input #2, strTextLineInput
' 相关处理
Loop
解决方案 »
- 啊啊啊~胸闷啊!又是TNND暴跌……偶滴血汗钱啊!
- 有按照时间生成的文件名,现在需要按照分钟级别进行复制
- vb发邮件的问题
- 我的程序用了中文,但在英文的操作系统显示乱码,请问怎样解决?
- 求类似广域网聊天工具的原码!
- 高分求解答~~~Setup Factory 6.0怎么用!???分不够再加100~~~~~
- 定义一个全局函数该如何定义?只是一个执行过程的函数?马上给分!!
- DataGrid的问题
- 紧急问题,我有两个表。如何不用循环比较两个表的数据的不同的地方。然后把他们选出来呢??
- 天哪,我的vb6引用中没有excel对象
- VB如何实现windows的搜索功能(可以通过查询文件中所包含的文字)?
- vb6的报表的问题
Open Text1.Text For Input As #2
iCol = 0
iNumber = 0
Do While Not EOF(2)
strTextLineInput = ""
Line Input #2, strTextLineInput
' 相关处理
Loop