[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Multiselect in DBGRid

Posted on 1997-05-04
2
Medium Priority
?
403 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 300 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

864 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