How to go first row and first colum in DBGrid?!?! lazarus / 16-Databases ---------------------------------------------------------------------- majid.ebru · 2017-08-09 09:43 Hi . after i insert data to databank , the cursore of DBGrid goes to last colum and last row. . how can i go(set or setfuce or ....) to the first colums and first rows?? . Thankyou ---------------------------------------------------------------------- majid.ebru · 2017-08-10 18:11 Hi i find answer here Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);begin  with TStringGrid(DBGrid1) do  begin    Row := 2;    Col := 5;    SetFocus;  end;end; ---------------------------------------------------------------------- Handoko · 2017-08-10 18:31 Did it work? I checked the documentation. Although they both share the same ancestor TCustomGrid, but TDBGrid is not a descendent of TStringGrid. http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tstringgrid.html http://lazarus-ccr.sourceforge.net/docs/lcl/dbgrids/tdbgrid.html I think it is better to use: with TCustomGrid(DBGrid1) do ---------------------------------------------------------------------- mangakissa · 2017-08-11 06:27 TSQLQuery.first ---------------------------------------------------------------------- majid.ebru · 2017-08-11 08:37 Hi . Quote from: Handoko on August 10, 2017, 08:31:23 pmDid it work? . I think it is better to use: with TCustomGrid(DBGrid1) do . . . Yes, it no work correctly , but it is better than DBGrid goes to last row and last colunm. . . . Quote from: Handoko on August 10, 2017, 08:31:23 pmI think it is better to use: with TCustomGrid(DBGrid1) do . . . the TCustomGrid does not have Row and Col ,but it has FRow and FCol and they are Private.!?!? . . . Quote from: mangakissa on August 11, 2017, 08:27:25 amTSQLQuery.first . . . . after i insert data , i use this code : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ZQuery_1.SQL.First but do not work?!?! ---------------------------------------------------------------------- mangakissa · 2017-08-11 11:09 read my post #3 ---------------------------------------------------------------------- majid.ebru · 2017-08-11 12:42 Quote from: mangakissa on August 11, 2017, 01:09:37 pmread my post #3 OK . where i use your code? after insert?i use exactly write your code?my Zquery name is "ZQuery_1"?my code is wrong? ---------------------------------------------------------------------- mangakissa · 2017-08-11 13:56 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  Zquery.post;  Zquery.first;end; Your info about saving is incomplete. There are a lot of ways to save data to your table. Think that TDBgrid is a dummy component that give you focus to your records. All the things you do with data will be passed to your dataset with the help of TDatasource. If you're using DBNavigator, put it in a OnClick event. ---------------------------------------------------------------------- majid.ebru · 2017-08-17 17:22 Quote from: mangakissa on August 11, 2017, 03:56:16 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  Zquery.post;  Zquery.first;end; Your info about saving is incomplete. There are a lot of ways to save data to your table. Think that TDBgrid is a dummy component that give you focus to your records. All the things you do with data will be passed to your dataset with the help of TDatasource. If you're using DBNavigator, put it in a OnClick event. Hi it doesn't work ?!?! ---------------------------------------------------------------------- taazz · 2017-08-17 18:38 Quote from: majid.ebru on August 17, 2017, 07:22:22 pmQuote from: mangakissa on August 11, 2017, 03:56:16 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  Zquery.post;  Zquery.first;end; Your info about saving is incomplete. There are a lot of ways to save data to your table. Think that TDBgrid is a dummy component that give you focus to your records. All the things you do with data will be passed to your dataset with the help of TDatasource. If you're using DBNavigator, put it in a OnClick event. Hi it doesn't work ?!?! prove it. I say it works. post a sample that does not work.