Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

VB 2008 Split Function/Method (please help)

$
0
0
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

Viewing all articles
Browse latest Browse all 21243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>