Solved

the last record that is displayed in the dbgrid?

Posted on 1998-07-01
6
299 Views
Last Modified: 2010-04-04
I want to get the last(or the nth) record that is
displayed in the dbgrid,how can I get it?
0
Comment
Question by:yd
6 Comments
 
LVL 1

Expert Comment

by:michaue
ID: 1356895
If you are using Paradox tables set the RecNo property of the TTable component to move to the record (9th or whatever)

Or you can look at the MoveBy method of TDataset
0
 
LVL 1

Expert Comment

by:michaue
ID: 1356896
Or if it's truely the very last record use the TDataSet.Last method !!!
0
 
LVL 3

Expert Comment

by:vladika
ID: 1356897
Try to create your own component

type
  TMyDBGrid = class(TDBGrid)
  public
    procedure ScrollToFirstVisible;
    procedure ScrollToLastVisible;
    procedure ScrollToNVisibleRow(N: Integer);
  end;

procedure TMyDBGrid.ScrollToFirstVisible;
begin
  with DataLink do
    if Active then DataSet.MoveBy(-ActiveRecord);
end;

procedure TMyDBGrid.ScrollToLastVisible;
begin
  with DataLink do
    if Active then DataSet.MoveBy(RecordCount-ActiveRecord-1);
end;

procedure TMyDBGrid.ScrollToNVisibleRow(N: Integer);
begin
  with DataLink do
    if Active then
    begin
      if N < 1 then N := 1;
      if N > RowCount then N := RowCount;
      DataSet.MoveBy(-ActiveRecord-1+N);
    end;
end;


0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:yd
ID: 1356898
I am sorry for my little explaination!
Now I explain it detailedly.I hope you can help me!
I want to make a touch-screen program.
Because My touch-screen is 17",it must display two dbgrids
in one screen,and that two dbgrids use the same dataset.
When I click the next or prev,The first dbgrid move 10,
and the second dbgrid move next 10.
If I use moveby, that two dbgrids display the same record.
That is not my want.
So I want to  know the last record that is displayed in the first dbgrid to transfer to the second dbgrid.

can you tell me how to get the field from dbgrid and not from
dataset?

Can you tell me how can I do that?
0
 
LVL 3

Expert Comment

by:AndreasSchindler
ID: 1356899
Try to create your own component

type
  TMyDBGrid = class(TDBGrid)
  Published
   Property Toprow;
   Property VisibleRowCount;
  end;

These Propertys came from TCustomGrid. You are informed by Query/Table Afterscroll that the position has changed. By checking dbgrid.Toprow you can see if the grid has scrolled.

0
 

Accepted Solution

by:
boabyte earned 50 total points
ID: 1356900
You could use two datasets from the one table. This way you can easily keep track
of leap-frogging dbgrids.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

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…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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