Solved

Insert at the last row in the Dbgrid

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now