Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

My Question about list

I Have two question.

1. I want to get 10 element from the bottom:

Example : if i have a list like this:
a
a
a
a
a
[b]a
a
a
a
a
a
b
b
b
b[/b]

and I want to get 10 element from the bottom (letter in bold),
Anyone can tell me how to do that. I try to use For Next Statement,
but I cann't find the solution.


2. May I use this statement:

y = 0

For i = y To List1.ListCount - 1 ' Is This row have effect?
For j = i To List1.ListCount - 1
If List1.List( i ) = List1.List( j )
vote = vote + 1
Else
y = j
vote = 0
Exit For
Next j
Next i

Comments

  • zibadianzibadian Member Posts: 6,349
    : I Have two question.
    :
    : 1. I want to get 10 element from the bottom:
    :
    : Example : if i have a list like this:
    : a
    : a
    : a
    : a
    : a
    : [b]a
    : a
    : a
    : a
    : a
    : a
    : b
    : b
    : b
    : b[/b]
    :
    : and I want to get 10 element from the bottom (letter in bold),
    : Anyone can tell me how to do that. I try to use For Next Statement,
    : but I cann't find the solution.
    :
    :
    : 2. May I use this statement:
    :
    : y = 0
    :
    : For i = y To List1.ListCount - 1 ' Is This row have effect?
    : For j = i To List1.ListCount - 1
    : If List1.List( i ) = List1.List( j )
    : vote = vote + 1
    : Else
    : y = j
    : vote = 0
    : Exit For
    : Next j
    : Next i
    :
    :
    Here's how to get the last ten items of a list:
    [code]
    For j = List1.ListCount-10 To List1.ListCount - 1
    // Do something with the items returned
    Next j
    [/code]
Sign In or Register to comment.