Please consider I am very new with VB.NET when attempting to read and answer my question
I have a textbox that takes in a list of words separated with a comma on the same line. When button is clicked string gets assigned to variable text and I then split it to variable arrayText. Then I loop over it and display each element of array on new line.
My code looks as follows
Dim text As String
Dim arrayText() As String
text = TextBox1.Text
arrayText = text.Split(",") 'every "," generates new array index, removes ","
text = ""
For i = 0 To arrayText.Length Step 1
text = arrayText(i) & vbCrLf
MsgBox(text)
Next
When debugging I get error message array out of bounds, however when I remove the newline character (vbCrLf) it displays my text, word for word in a messagebox (which I am using for debugging) and at the end of the loop it kicks out with same error message.
What am I doing wrong here, any improvement suggestions?