Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

Navigating through an ArrayList

Hi All,

Ok, so now I have an ArrayList called RecordIDArray

It simply holds lots of record ID's.

I'm looking to navigate through it with 4 buttons.

- One for 'Next Record'
- One for 'Previous Record'
- One for 'Last Record'
- One for 'First Record'

What code would I use on these 4 buttons to move through my ArrayList?

Many thanks
0
ITranger
Asked:
ITranger
1 Solution
 
xersoftCommented:
Keep track of an index in a member variable such as:

Dim CurrentIndex as integer = 0

Now in each button figure out what action you need to take on that index:

- One for 'Next Record'
      * Add one to the current index
      * if the currentindex > the = count of items in array -1 then set the current index to 0
      * redisplay data
- One for 'Previous Record'
      * Subtract one from the current index
      * if the currentindex < 0 then set the currentindex = count of items in array -1
      * redisplay data
- One for 'Last Record'
      * set the current index to the = count of items in array -1
- One for 'First Record'
      * set the currentindex to 0
0
 
ITrangerAuthor Commented:
Ahh, I see - that member variable is key!

Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now