Bonjour,
Cela parait simple mais je n'arrive pas à m'en sortir avec
cette logique
Je veux dire décendre toutes les lignes de stringgrid si la condition n'est pas remplie jusqu'à qu'elle
le soit à nouveau :
Les variables indicées nom, codepostal, ville sont enregistrées dans un fichier x
La variable indicée nomsup est dans un fichier y.
Par comparaison, si nom est différent de nomsup j'aimerais que nom + codepostal + ville descendent d'une
ligne dans stringgrid

exemple :
si nom[n] = nomsup[n] alors écrit les variables codepostal + ville sur la ligne correspondante de la stringgrid
si nom[n] <> nomsup[n] alors la ligne correspondante :=''et descend d'une ligne nom +code postal +ville
si nom[n] = nomsup[n] alors écrit les variables codepostal + ville sur la ligne correspondante de la stringgrid
si nom[n] = nomsup[n] alors écrit les variables codepostal + ville sur la ligne correspondante de la stringgrid
si nom[n] <> nomsup[n] alors la ligne correspondante :=''et descend d'une ligne nom + code postal +ville
etc ...

Mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Stringgrid1.RowCount:= PosPosition1; // integer
for n:= 1 to PosPosition1-1 do begin
if indexCotisFNI[n].PositionFNI= IndexPosition1[n].Position1
  then begin
      stringgrid1.Cells[0,n]:= IndexPosition1[n].Position1;
      stringgrid1.Cells[1,n]:= inttostr(IndexPosition1[n].FNI);
      stringgrid1.Cells[2,n]:= indexCotisFNI[n].ReglesFNI;
      stringgrid1.Cells[3,n]:= indexCotisFNI[n].ResteFNI;
      stringgrid1.Cells[5,n]:= indexCotisFNI[n].MontantFNI;
      end
      else begin // si différent de IndexPosition1[n].Position1
      stringgrid1.Cells[0,n]:= IndexPosition1[n].Position1;
      stringgrid1.Cells[1,n]:=   inttostr(IndexPosition1[n].FNI);       stringgrid1.Cells[2,n+1]:=indexCotisFNI[n].ReglesFNI;
      stringgrid1.Cells[3,n+1]:= ndexCotisFNI[n].ResteFNI;
      stringgrid1.Cells[5,n+1]:= indexCotisFNI[n].MontantFNI;
      end;
  end;
Merci d'avance