how to clear an array index list and the re create it

I have the following code:

 Public tempArray() As String
  tempArray = strDataCOM1.Split(New Char() {Chr(13)}, StringSplitOptions.RemoveEmptyEntries)

Open in new window

I notice that my array is getting cleared out however my index is not re-dimensioning. I would like to clear old data left in the temparry and also set the array index to 0 and let it re create.

Thanks in advance
Who is Participating?
Pawan KumarDatabase ExpertCommented:
Not very sure why you are doing this but you may need this. Please try this -

Clear method...

Array.Clear(tempArray , 0, tempArray.Length);
cmdolcetAuthor Commented:
Thanks, and then to further I redim my array length
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.