Hello,
I am trying to get the items out of a listbox and put into a text box .. I am putting the listbox items into an array and I keep getting this error:
InvalidArgument=Value of '1' is not valid for 'index'. Parameter name: index
bolded code where this occurs
here is my code:
I am trying to get the items out of a listbox and put into a text box .. I am putting the listbox items into an array and I keep getting this error:
InvalidArgument=Value of '1' is not valid for 'index'. Parameter name: index
bolded code where this occurs
here is my code:
VB.NET:
Private Sub btn_BuildText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_BuildText.Click
Dim delimiter As String 'Holds the String character representing the chosen delimiter
Dim i As Integer 'Loop counter
Dim tempString As String 'Holds the input string from the text box
tempString = txt_UserInput.Text
If rb_Comma.Checked Then
delimiter = ","
ElseIf rb_CRLF.Checked Then
delimiter = "& vbCRLF"
ElseIf rb_Space.Checked Then
delimiter = " "
Else
MessageBox.Show("You must select a delimiter!")
Exit Sub
End If
Dim stringArray() As String = Split(tempString, delimiter)
For i = 0 To lb_BuildText.Items.Count
[B]stringArray(i) = lb_BuildText.Items(i).ToString()[/B]
Next
txt_UserInput.Text &= stringArray(i) & delimiter
End Sub