循环后VB程序停止

问题描述

我正在使用VB 2101 Express,我试图纠正该程序,但它不会超出循环的结尾,有人知道为什么吗?
If (Not System.IO.Directory.Exists(root + \"\\setting\")) Then
    System.IO.Directory.CreateDirectory(root + \"\\setting\")
End If

\'loads world settings
If File.Exists(root + \"\\setting\\world.txt\") Then
    Dim ioFile As New StreamReader(root + \"\\setting\\world.txt\")
    Dim ioLine As String \' Going to hold one line at a time
    Dim ioLines As String \' Going to hold whole file

    ioLine = ioFile.ReadLine
    ioLines = ioLine

    Do
         ioLine = ioFile.ReadLine
         ioLines = ioLines & vbCrLf & ioLine
         cmbworld.Items.Add(ioLine)
    Loop Until ioLine = \"\" \'***<--- IT STOPS HERE!***

Else
    System.IO.File.Create(root + \"\\setting\\world.txt\")
End If
    

解决方法

        这不是更简单吗?
For Each line As String In File.ReadLines(\"root + \"\\setting\\world.txt\"\")
    If line.Length <> 0 Then
        cmbworld.Items.Add(line)
    End If
Next line
MSDN:File.ReadLines方法(字符串)     ,        尝试将最后一行设置为
Loop Until ioLine is nothing
    

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...