Hello all,
I'm trying to do a small application that has this string as an imput "11010" and my goal is to divide the string and load it into an array in this way:
[1][11][110][11010]
The code that I came up with is this:
[CODE=vbnet]Public Class Form1
Dim prefixes(10000) As String
Dim s As String
Dim count As Integer
Dim j As Integer
Dim pre_lenght As Integer
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
TextBox1.Text = "11010"
s = TextBox1.Text
pre_lenght = TextBox1.TextLe ngth
j = pre_lenght
While j > 0
For Me.count = 0 To count = pre_lenght
prefixes(Me.cou nt) = s.Substring(pre _lenght - j)
j = j - 1
Next
End While
Label1.Text = j
Label2.Text = pre_lenght
Label3.Text = prefixes(0)
End Sub
End Class[/CODE]
For some reason it is just storing information in the position 0 of prefixes() and not in any other position,
If someone have any idea of how to solve this problem please let me know.
Thanks.
Daniel.
I'm trying to do a small application that has this string as an imput "11010" and my goal is to divide the string and load it into an array in this way:
[1][11][110][11010]
The code that I came up with is this:
[CODE=vbnet]Public Class Form1
Dim prefixes(10000) As String
Dim s As String
Dim count As Integer
Dim j As Integer
Dim pre_lenght As Integer
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
TextBox1.Text = "11010"
s = TextBox1.Text
pre_lenght = TextBox1.TextLe ngth
j = pre_lenght
While j > 0
For Me.count = 0 To count = pre_lenght
prefixes(Me.cou nt) = s.Substring(pre _lenght - j)
j = j - 1
Next
End While
Label1.Text = j
Label2.Text = pre_lenght
Label3.Text = prefixes(0)
End Sub
End Class[/CODE]
For some reason it is just storing information in the position 0 of prefixes() and not in any other position,
If someone have any idea of how to solve this problem please let me know.
Thanks.
Daniel.
Comment