Listbox question

Post

Posted
Rating:
#26
Regular
rj71 is in the usergroup ‘Regular’

BruceSteers said

If you've reversed the other list then it's index is just Length-position
same code as when i reversed the list and set the selected item.

ListBox2.Index = ListBox1.List.Max - ListBox1.Index

Wow. That worked. Thanks Bruce! It can go forwards and backwards using 2 listboxes!
Online now: No Back to the top

Post

Posted
Rating:
#27
Guru
BruceSteers is in the usergroup ‘Guru’
I had another idea…

To go backwards you could just take 10 from the index and then use the normal show 5.

Ie…

Code (gambas)

  1. Public Sub btnBack_Click()
  2.  
  3.   ListBox1.Index = Max(0, ListBox1.index - 10)  ' go back 10 or to 0 if index - 10 is less than 0
  4.  
  5.   Button3_Click()  ' run the code that shows the next 5 items
  6.  
  7.  
Online now: No Back to the top

Post

Posted
Rating:
#28
Regular
rj71 is in the usergroup ‘Regular’

BruceSteers said

I had another idea…

To go backwards you could just take 10 from the index and then use the normal show 5.

Ie…

Code (gambas)

  1. Public Sub btnBack_Click()
  2.  
  3.   ListBox1.Index = Max(0, ListBox1.index - 10)  ' go back 10 or to 0 if index - 10 is less than 0
  4.  
  5.   Button3_Click()  ' run the code that shows the next 5 items
  6.  
  7.  

ooooh I like this. Thanks Bruce!
Online now: No Back to the top
1 guest and 0 members have just viewed this.