Hi
I am struggling with this bit of code as it is getting an exception... I am trying to get the program to split the text that is already saved in the textbox1 and to show result in textbox2. I could not do it so went with the msgbox instead but after it shows all the msgboxes it the comes up with the exception..."Index was outside the bounds of the array." while highlighting MsgBox(B(J))
Please help, what is wrong with the code below???:confused:
Private Sub btnSplit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSplit.Click
Dim A As String = Me.TextBox1.Text
Dim B() As String
Dim J As Integer
B = A.Split(". ")
For J = 0 To UBound(A.Split)
MsgBox(B(J))
Next
End Sub
I am struggling with this bit of code as it is getting an exception... I am trying to get the program to split the text that is already saved in the textbox1 and to show result in textbox2. I could not do it so went with the msgbox instead but after it shows all the msgboxes it the comes up with the exception..."Index was outside the bounds of the array." while highlighting MsgBox(B(J))
Please help, what is wrong with the code below???:confused:
Private Sub btnSplit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSplit.Click
Dim A As String = Me.TextBox1.Text
Dim B() As String
Dim J As Integer
B = A.Split(". ")
For J = 0 To UBound(A.Split)
MsgBox(B(J))
Next
End Sub