Solved

Multiselect in DBGRid

Posted on 1997-05-04
2
391 Views
Last Modified: 2010-04-06
Hello,

I'm using Delphi 2.0 with the new DBGrid component where you have
the option to set multiselect on.
How do I know how many and wich records are selected in such a DBGrid ?  

Thanks in advance,
Pascal Corstjens
Belgium

Corpa@glo.be
0
Comment
Question by:corpa
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
ID: 1335894
Just try this:

     NumSelected:=0;
     
     Table.Open;
     Table.First;
     while (not Table.EOF) do
     begin
        if DBGrid.SelectedRows.CurrentRowSelected then
        begin
          // Do whatever you want
          // with the selected record  
          NumSelected:=NumSelected+1; //Number of selected rows
        end;
        Table.Next;
      end

You can also use bookmarks to avoid losing previous database pointer.
0
 
LVL 2

Expert Comment

by:javiertb
ID: 1335895
Any help on evaluating questions?? ;-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

825 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