0
我試着輸入解析出的所有字符串轉換爲二維數組,其中第5串補一列隨機字符串,然後在未來5組成第二列等。然後我需要隨機選擇3列,並輸出該列中的每個字符串。選擇從分隔文本文件
path = My.Computer.FileSystem.GetFileInfo("Two_Point_One_Questions.txt")
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(path.FullName)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
Dim currentField As String
Dim i As Integer = 1
Dim j As Integer = 1
For Each currentField In currentRow
Question(i, j) = currentField
j = j + 1
Next
Catch ex As Microsoft.VisualBasic.
FileIO.MalformedLineException
MsgBox("Line " & ex.Message &
"is not valid and will be skipped.")
End Try
End While
End Using
問題是...? –
您不會增加變量i – Steve