0
While Not sr.EndOfStream
line = sr.ReadLine
If line.Contains("Year") Then
currentYear = line.ToString
ElseIf line.Contains("mandatory") Then
moduleStats = "M"
ElseIf line.Contains("optional") Then
moduleStats = "O"
ElseIf line.Contains("COM") Then
modArray = line.Split(",")
Dim i As Integer = modArray.Length
ReDim Preserve modArray(modArray.Length + 2) 'ReDim statement to change the size of one or more dimensions of an array,
'Preserve you can resize that dimension and still preserve all the contents of the array
modArray(i) = moduleStats
modArray(i + 1) = currentYear.ToString()
MsgBox(String.Join(",", modArray))
これは私のコードです。メッセージボックスに配列を表示すると、各要素の終わりにコンマが入りますが、各要素についてこれをどのように整えることができないのでしょうか?ありがとう最後の "、"を配列要素ごとにトリミングできる方法はありますか?
あなたは 'あなたが使用していない1つの余分の要素に配列をReDim'edことがありますか? – Oded
それは問題だった!私は1つの余分な要素を運ぶために配列をredimedし、それはそれを固定しました – aspiringCoder