Select all rows in DBGrid

Posted on 2001-06-18
Last Modified: 2010-04-06
Hi Experts,

I'm using a DBGrid in an application, with the Multiselect and Rowselect properties set to true. So users can select multiple rows with the Ctrl key pressed.

Now I want to place a "Select all" button on my form as a special service to the users. When a user clicks that button all the rows in the DBGrid should be selected.

Is this possible?

Question by:JDN
1 Comment

Accepted Solution

VSF earned 50 total points
ID: 6203991
Here we go...
Hope this procedure helps!!!


You will need to set the multiselect property to true.

(Expand the options property to find multiselect.)

procedure TForm1.SelectAll;
 with dbgrid1.DataSource.Dataset do
     if (BOF and EOF) then Exit;
       while not EOF do
         dbgrid1.SelectedRows.CurrentRowSelected := True;

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 183
select query - oracle 16 101
PHP preg_replace code convert to Delphi 14 79
How to Get Images From Server using App Tethering 11 42
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question