dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Relational Databases
Expertise: Beginner
May 9, 1997

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


How to display "Record x of y"

Question:
I am writing a database app in Delphi that is a Customer/Order Management System, and need to display a '3 of 7' type info in the status bar. How can I get the position and number of records?

Answer:
TTable has two properties for displaying the current record and total records, respectively. They are:

RecNo and RecordCount

Your best bet is to place the code that would display these values in the OnDataChange event of your DataSource component as follows:

procedure TIFMain.DataSource1DataChange(Sender: TObject; Field: TField);
begin
  Panel1.Caption := IntToStr(Table1.RecNo) + ' of ' + 
                    IntToStr(Table1.RecordCount);
end;
because OnDataChange occurs every time something happens to the underlying data set, like scrolling to a new record.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date