Solved

Insert at the last row in the Dbgrid

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
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 …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 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