[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

The TDBGRID is moved when get all new record from TTable ?

Posted on 2002-07-14
11
Medium Priority
?
183 Views
Last Modified: 2010-04-04
Dear Advisor !


I use Delphi 5.0

TDBGRID is moved (be wriggled), when i retrieve new data from Table.

I also used InputForm.OrderTable.DisableConTrol. But it is not effcted.

Thanks for all
0
Comment
Question by:NamCit
[X]
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
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 7153533
Here your are an example, and works fine.
Best Regards.
Marcos.


         try
         DmNv.Ven.Disablecontrols;

          While not DmNv.Ven.EOF do
          begin
          nUnis:=nUnis + DmNv.Venunidades.Value;
          nImporte:=nImporte + DmNv.VENIMPORTE.Value;
          nComision:= nComision + DmNv.VENTTLCOMIS.Value;
          DmNv.Ven.Next;
          end;

          Finally
          DmNv.Ven.Enablecontrols;
0
 

Author Comment

by:NamCit
ID: 7153590

Dear !

"Moved" is meant "to be shaked"

There is no error for the customer. But i want the TDBGRID to be shake a little so that.

My code (after adding your comment) :

   DataQuery := HopDongForm.Query ;
           With DataQuery Do
           BeGin
            Active := False     ;
            SQL.Clear           ;
            SQL.Add('select a.*, b.tendv  from cthopdong a')    ;
            SQL.Add('left outer join dmdv b on a.madv = b.madv');
            SQL.Add('where sohd = :sohd')               ;
            Parameters.ParamValues['sohd'] := lcsohd    ;
            Open   ;
            First  ;

            DataControl := HopDongForm.DetailTable ;
      try
            DataControl.DisableControls ;

            While not Eof do
            Begin
               DataControl.Append ;
               DataControl.FieldByName('madv').AsString      := FieldByName('madv').AsSTring    ;
               DataControl.FieldByName('tendv').AsString     := FieldByName('tendv').AsString   ;
               DataControl.FieldByName('matt').AsString      := FieldByName('matt').AsString    ;
               DataControl.FieldByName('tienvn').AsInteger   := FieldByName('tienvn').AsInteger ;
               DataControl.FieldByName('diengiai').AsString  := FieldByName('diengiai').AsString ;

               Next    ;
            End ;
            DaTaControl.First ;
         Finally ;
            DataControl.EnableControls ;
         end ;
           End ;
0
 

Author Comment

by:NamCit
ID: 7153591

Still not effected
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:NamCit
ID: 7153602

What should i do next ?

I dont want TDBGRID to be "alive" when updating data .

Addtion, before insert new record, i delete all old record
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7153608
?
add a order by clause
0
 

Author Comment

by:NamCit
ID: 7153704

Please show me clearly
0
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 7154282
Try setting DoubleBuffered to True.
Best Regards.
Marcos.
0
 

Author Comment

by:NamCit
ID: 7155888

Dear Marcoszorrilla  !

I just set OrderForm.DoubleBuffered to True. But not effected.



0
 
LVL 17

Expert Comment

by:geobul
ID: 7157238
Delete the old records immediately after DataControl.DisableControls. Perhaps deleting shakes your grid.

Regards, Geo
0
 

Author Comment

by:NamCit
ID: 7158426

Yes, before updating new data, i should delete old data.

That makes TDBGrid "alive"
0
 
LVL 17

Accepted Solution

by:
geobul earned 60 total points
ID: 7158822
Did that solve the problem? For example:

DataControl.DisableControls ;
try
  // delete old records
  DataControl.Last;
  for i := DataControl.RecordCount downto 1 do
    DataControl.Delete;

  // add new records
  While not Eof do
  Begin
    DataControl.Append ;
    DataControl.FieldByName('madv').AsString      := FieldByName('madv').AsSTring    ;
    DataControl.FieldByName('tendv').AsString     := FieldByName('tendv').AsString   ;
    DataControl.FieldByName('matt').AsString      := FieldByName('matt').AsString    ;
    DataControl.FieldByName('tienvn').AsInteger   := FieldByName('tienvn').AsInteger ;
    DataControl.FieldByName('diengiai').AsString  := FieldByName('diengiai').AsString ;
    DataControl.Post; // post changes here
    Next    ;
  End ;
  DaTaControl.First ;
Finally ;
  DataControl.EnableControls ;
end ;

Regards, Geo
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

650 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