I have a listbox that is populated with records from a cursor. - rowsourcetype = 6 Fields. I have a command button on the form that selects or unselects all the records using the following code:
DO CASE
CASE this.caption = 'Select All Checks'
this.caption = 'Unselect All Checks'
STORE 0 TO lnCount, lnTotal
FOR lnX = 1 TO thisform.lstSelectChecks.ListCount
thisform.lstSelectChecks.Selected(lnX) = .T.
lnCount = lnCount + 1
lcidchec = thisform.lstSelectChecks.ListItem[lnX,7]
SELECT picktmp
LOCATE FOR cidchec == lcidchec
IF FOUND()
lnTotal = lnTotal + picktmp.nAmount
ENDIF
ENDFOR
CASE this.caption = 'Unselect All Checks'
this.caption = 'Select All Checks'
STORE 0 TO lnCount, lnTotal
FOR lnX = 1 TO thisform.lstSelectChecks.ListCount
thisform.lstSelectChecks.Selected(lnX) = .F.
ENDFOR
ENDCASE
The problem is that after all the records are selected, and the user wants to deselect some of the records, he should be able to hold CTRL and click the ones to deselect. What happens is that all the records get deselected except for the one that is clicked on. What are we doing wrong?
Thanks,
Phil Sherwood
SherWare, Inc.