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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check box in dbgrid

Status
Not open for further replies.

rizunb

Programmer
Feb 27, 2003
63
CA
Ok Guys
I have a dbgrid on the form. what I want is to have a checkbox inside the grid for each row.
here's is scenerio of what I want

1) when app starts the dbgrid will fill itself with the results of a query. and the result does not contain any boolean field that i can use for check box.

2) I need to have a separat check box column, so each row has a check box associated to it

3) by default it will be unchecked, but when the user checks the box, the row should be selected, or somehow I should be notified that this specific row is selected.

4) and what I want to do at the end is call a stored procedure by passing in only the id's from the row that are checked.

Now How do I create a check box field in dbgrid and how i do know when a checkbox is checked.
its a little complicated. I am working on it but any help will be appreciated
thanks
 
Hi,

DBGrid has a selectedrows property which is a TBookmarkList, and it has the functionality you describe...

You can select records bij clicking the thumb (i think), when DBGrid.Options include: dgRowSelect and dgMultiSelect

When the selected rows are needed you just walk the DBGrid.SelectedRows property (list).

Hth

- fruNNik
 
Hi - two other options :

Use the ExpressDBGrid from Quantum (I think)

Add a checkbox to each row. Set the parent to be the grid, and coords/size to fit. If you need to add a blank column, add something to the select statement, e.g. select id, name, '1' from mytable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top