Solved

the last record that is displayed in the dbgrid?

Posted on 1998-07-01
6
302 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

820 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