Solved

Select all rows in DBGrid

Posted on 2001-06-18
1
387 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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now