>I'm working to make a grid for an application, where I can select some records by clicking a checkbox in a grid. I figured out how to put a checkbox in a grid.
>Now i want an array containing the recordnumbers i have ticked in the grid. When I de-tick a checkbox in the grid i whant to remove the record number from the array. But when I bind:
>
>=iIf( ASCAN( aRecs, RecNo() ) = 0,.F.,.T.)
>
>to the controlsource of the checkbox column the grid blanks when I want to run it. What's wrong and how can i solve it ?
Arrays are dangerous for grids because they have a limit of 65000 elements.
Next you don't need an array or something else where you already have a field for it. If you don't have a field than it'd be a calculated field which is readonly and you wouldn't be able to mark/unmark.
Grid goes blank when it cannot resolve a column's controlsource expression. Here most probably it went blank for you used arecs as a local array. As assigning controlsource routine ended aRecs went out of scope. If aRecs were a say form property or public grid wouldn't go blank.
However remember this way you're predetermining selected records and marking them, user can't change it.
Another note on your expression :
If your expression would return a logical then it's unnecessary to make an iif() construction. Directly write the logical expression. ie :
(ascan(thisform.aRecs,Recno())#0)
Cetin