【发布时间】:2014-03-27 20:37:13
【问题描述】:
我正在尝试将所有已解析的字符串输入到一个二维数组中,其中前 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