Link to home
Start Free TrialLog in
Avatar of NamCit
NamCit

asked on

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

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
Avatar of marcoszorrilla
marcoszorrilla

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;
Avatar of NamCit

ASKER


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 ;
Avatar of NamCit

ASKER


Still not effected
Avatar of NamCit

ASKER


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
Avatar of kretzschmar
?
add a order by clause
Avatar of NamCit

ASKER


Please show me clearly
Try setting DoubleBuffered to True.
Best Regards.
Marcos.
Avatar of NamCit

ASKER


Dear Marcoszorrilla  !

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



Delete the old records immediately after DataControl.DisableControls. Perhaps deleting shakes your grid.

Regards, Geo
Avatar of NamCit

ASKER


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

That makes TDBGrid "alive"
ASKER CERTIFIED SOLUTION
Avatar of geobul
geobul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial