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
Solved

Insert at the last row in the Dbgrid

Posted on 1997-11-25
3
470 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…

861 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