Solved

the last record that is displayed in the dbgrid?

Posted on 1998-07-01
6
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month4 days, 23 hours left to enroll

635 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