Solved

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

Posted on 2002-07-14
11
170 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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