Results 1 to 10 of 10

Thread: [Resolved]Reorganising Arrays...

Threaded View

  1. #1

    Thread Starter
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    [Resolved]Reorganising Arrays...

    Well, I need to reorganise my arrays by being able to insert data in at the start, and push everything down which I have done with the following code,

    VB Code:
    1. Public RndTracker(19) As String
    2. Public TempArray(19) As String
    3. '---
    4.  
    5. IntCurrindex = tempint   'temp int is a random integer
    6.  
    7. For i = 0 To UBound(RndTracker)
    8.   If i = 0 Then
    9.     Temparray(0) = IntCurrindex
    10.     Temparray(1) = RndTracker(0)
    11.   ElseIf i > 0 Then
    12.     Temparray(i) = RndTracker(i - 1)
    13.   End If
    14. Next i
    15.  
    16. 'Copy back
    17. For i = 0 To UBound(Temparray)
    18. RndTracker(i) = Temparray(i)
    19. Next i

    The above code works well, but, I want to be able to go back through the array and reorganise it again.. which is where I've managed to get myself confused.

    Basically I would need to remove the first item, and then replace it with the second item in the array, and I guess just make the last item in the array zero?

    Should be an easy one for you guys (I hope), also just want to check that is the best way of doing it.

    Thanks in advance.
    Last edited by Pc_Madness; Apr 29th, 2003 at 01:55 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width