Solved

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

Posted on 2002-07-14
11
174 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 20 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

707 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