Solved

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

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

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now