Solved

Select all rows in DBGrid

Posted on 2001-06-18
1
422 Views
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?

Thanks,
JDN
0
Comment
Question by:JDN
1 Comment
 
LVL 3

Accepted Solution

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

VSF
www.enge.cjb.net
www.victory.hpg.com.br

SELECT ALL ROWS IN A DBGRID
You will need to set the multiselect property to true.

(Expand the options property to find multiselect.)

procedure TForm1.SelectAll;
begin
 with dbgrid1.DataSource.Dataset do
   begin
     if (BOF and EOF) then Exit;
     DisableControls;
     try
       First;
       while not EOF do
       begin
         dbgrid1.SelectedRows.CurrentRowSelected := True;
         Next;
       end;
     finally
       EnableControls;
     end;
end;
   end;  
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

786 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