Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Insert at the last row in the Dbgrid

Posted on 1997-11-25
3
Medium Priority
?
494 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 300 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Integration Management Part 2
Screencast - Getting to Know the Pipeline

782 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