Autor Beitrag
rhodan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: Di 11.10.05 08:58 
Moin,

hab gerade nen ziemlichen schreck bekommen als ich sehen musste wie die datei die ich in ein Stringgrid lud nach 999 Zeilen abgeschnitten wurde :shock:

das hier ist der code mit dem ich mein grid fülle:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
var
datei : TextFile;
  dateiname : String;
  zeile : String;
  inhalt : String;
  perslist : Sarr;
  pers : Sarr;
i, j : integer;
  
begin
  dateiname := ('c:\rankinglist.htm');
  AssignFile(datei, dateiname);
  reset(datei);
  inhalt := '';
  repeat
    Readln(datei, zeile);
    inhalt := inhalt + zeile;
  until eof(datei);
  CloseFile(datei);
  inhalt := getTable(inhalt);
  perslist := getEntries(inhalt);

  i := 0;
  while (perslist[i] <> '') do
  begin
    pers := processAccount(perslist[i]);
    for j := 0 to 11 do
    begin
      Stringgrid1.cells[j+1,i+1]:=pers[j];
    end;
    inc(i);
  end;
 end;
end;


meine datei umfasst aber ca. 1200- 1300 zeilen, also fehlen mir welche. gibt es einen weg vielleicht vorher schon ein reserve grid zu erstellen wo die restlichen zeilen (im falle das das erste voll ist) reingeladen werden?

Per Suchfunktion hab ich explezit mit diesem thema nix gefunden.. :?

Bitte kann mir jemand (vielleicht anhand meines codes) sagen wie ich das bewerkstelligen kann?

gruß

rhodan
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 11.10.05 09:32 
Dein StringGrid kann mehr als 999 Zeilen aufnehmen. Du musst beim Einlesen der Zeilen aus der Datei nur feststellen wieviel Zeilen du eingelesen hast. Danach setzt du Rowcount vom StringGrid einfach auf die richtige Anzahl.
rhodan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: Di 11.10.05 23:09 
ah, nice, danke dir erstmal für deine antwort.
habs geschafft sie alle anzuzeigen, allerdings nicht das das grid selbstständig liest wieviele zeilen eingelesen wurden.

könntest du mir den befehl dafür nennen, oder anhand meines codes wo ich etwas ändern muss.

Vielen Dank

rhody
ub60
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 765
Erhaltene Danke: 130



BeitragVerfasst: Di 11.10.05 23:58 
Hallo rhodan,

in i zählst Du doch die Anzahl der Zeilen mit, wenn ich nicht irre. Mit einer Zeile Überschrift müsste das dann so aussehen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
  
while (perslist[i] <> '') do
  begin
    pers := processAccount(perslist[i]);
    // neu
    if i+2>10 // oder was Du eben eingestellt hast
      then Stringgrid1.RowCount:=i+2;
    // weiter
    for j := 0 to 11 do
    begin
      Stringgrid1.cells[j+1,i+1]:=pers[j];
    end;
    inc(i);
  end;



ub60

Moderiert von user profile iconUGrohne: Code- durch Delphi-Tags ersetzt
rhodan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: Mi 12.10.05 01:39 
DANKE!! :D :D

genau das was ich was ich möchte, hat sofort geklappt, keine korrekturen nötig :wink:

Thanks