Solved

Insert at the last row in the Dbgrid

Posted on 1997-11-25
3
467 Views
Last Modified: 2010-04-04
I use the navigator and the dbgrid.
When i press the insert button dbgrid is not going to the
last line . How can i manage that.
0
Comment
Question by:gipa
  • 2
3 Comments
 

Author Comment

by:gipa
ID: 1351743
Adjusted points to 100
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1351744
Well, that's normal. If you push the insert button, the record will be put before the record which is selected. Why do you want to go to the last line? If you really want to do that you can do this by using a button and in that click-event call Table1.Append.
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1351745
Well, if you really want that whenever user clicks on the insert button the dbgrid goes to the last line. You can use this little piece of code. Use the BeforeInsert event of TTable and put procedure Last in it.

What happens? Before Table1.Insert is called this event (BeforeInsert) will be called and then the table pointer will be moved to the last record. After this the Insert will be called, but because of the fact that the last line is selected, this insert will act like an append.

procedure TForm1.Table1BeforeInsert(DataSet: TDataSet);
begin
 Table1.Last;
end;

Have fun,
c.u. ZifNab;
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

809 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