We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Navigating through an ArrayList

ITranger
ITranger asked
on
Medium Priority
456 Views
Last Modified: 2006-11-18
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
Comment
Watch Question

Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Ahh, I see - that member variable is key!

Thanks
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.