Need help in increasing the size of my array. i have this code but i don't know which of these code does not increase the size of my array even though i increment it.
This is the declarations:
Dim movieArray(0) As String
Dim ratingArray(0) As String
Dim i As Integer
This is the code:
movieArray(i) = movieTxt.Text
ratingArray(i) = ratingCmb.Text
'System.Array.Sort(movieArray)
Try
For Each Str As String In movieArray
If Str IsNot Nothing Then
Dim newItem As New ListViewItem(movieArray(i))
newItem.SubItems.Add(ratingArray(i))
ListView1.Items.Add(newItem)
ratingCmb.SelectedIndex = 0
warnNoMovie.Text = ""
warnNoRating.Text = ""
End If
Next
ListView1.Items.Clear()
ReDim Preserve movieArray(i)
ReDim Preserve ratingArray(i)
For a = 0 To i
Dim newItem As New ListViewItem(movieArray(i))
newItem.SubItems.Add(ratingArray(i))
ListView1.Items.Add(newItem)
Next
i += 1
MsgBox(movieArray.Length)
Catch err As Exception
MsgBox(err.Message)
End Try
i post the declarations so that if there's wrong with my declarations you can tell me.
Thanks in advance.