Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox in Grid, one changes and affects all

Status
Not open for further replies.

kraus

MIS
Oct 16, 2000
23
US
i added a checkbox to a grid that contains a cursor of a remote sql datasource. i add the column and checkbox at run time. the column and the checkbox it contains has no control source. i set sparse to false so there is a checkbox on every row. the purpose of the checkbox is to mark each record for deletion. (i know i could enable the delete mark but, that is not what the client wants). when one checkbox is checked, all checkboxes in every row become checked. this can't happen. what am i doing wrong? must there be a field in the local cursor that the checkbox can bind to? your help would be much appreciated.
 
the code just changes the checkbox value to 1 or zero and deletes record accordingly. ther is no controlsource. does there have to be?
 
Kraus,

ther is no controlsource.

I think that's your problem. Without a control source, all the checkboxes will have the same value. Or, more precisely, there is only one checkbox -- not one per row.

If you are using a cursor to populate the grid, I suggest you add a logical field to it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
ok - that is what i thought - thank you very much for your help. you da men
 
One way to do this without adding a field to the source table is to add a logical field to your cursor with the CAST() function: i.e.

SELECT unit_id, CAST(unit_id as Logical) AS lUnit FROM ALIAS() INTO CURSOR temp readwrite

Now populate the Grid using temp. temp.lUnit is the control source for the column with the check box... now you can delete any record that is checked... well you get the idea.
 
After you added a logical field and bind the column with the checkbox to it, also don't forget to set the column's sparse to .F.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top