Listbox CellCheck

I use a routine no Check All Listbox.CellCheck Cell’s at once.

The issue is: the first time I try to test all listbox.cellcheck cells it returns FALSE. The second time I test it returns TRUE.

How I set all Listbox.CellCheck ?
Like this:
For i = 0 to LbxPecas.ListCount -1
LbxPecas.CellCheck(i,1) = True // the checkbox is in the second column

How I test the value?
Like this:
If LbxPecas.CellCheck(i,1)= True Then

What am I doing wrong?

Thanks in advance.

Take a look at CellState

Thanks Johnny, I already tried to use CellState. with the Enum but It does the same result.

Test for checked like this:

if  MyList.cellstate(row,col) = Checkbox.CheckedStates.Checked  then

Set the value like this:

MyList.CellState(row,col) = Checkbox.CheckedStates.Checked

Also (but not in the question):

If LbxPecas.CellCheck(i,1) Then

Will do the same: = True is not mandatory. If LbxPecas.CellCheck(i,1) = False Then: = False is mandatory here.