E B
E B

Reputation: 27

vb.net list confusion

I am looping through a list for a spellchecker in vb.net (using vs 2010). I want to go through a wrongly spelled word list. Each time the code picks the index that's one higher than the index of the last checked word.

In my version of notquiteVB/Pythonese I think it would translate something like:

(start loop)
dim i as Integer = 0  
dim word as String
word = words_to_check_at_spellcheck.Item(0 + i)
i = i+1
(end loop)

But this doesn't work at all...when it gets to the last item in the list and reaches 'word = ' it throws the error of 'out of range -- must be less than the size of the collection'.

How do you get the last item in a list? Maybe lists aren't what VB uses for this kind of thing?

Upvotes: 0

Views: 119

Answers (1)

Josh
Josh

Reputation: 2975

If you're collection of misspelled words is named mispelled:

For Each word As String In mispelled
    'Do something
Next

Upvotes: 1

Related Questions