Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Memo in Stringgrid (https://www.delphipraxis.net/36296-memo-stringgrid.html)

Masterof 18. Dez 2004 09:01


Memo in Stringgrid
 
Hallo!!

Ich möchte diese Zeile (Abänderung {f} :: modification) gern trennen und in einem Stringgrid das erste Wort in die 1. Spalte und das 2. Wort in die 2. in die Spalte daneben schreiben. Die Zeilen stehen so in einem Memo. Wie funktioniert das?

MfG Master

Sharky 18. Dez 2004 09:10

Re: Memo in Stringgrid
 
Hai Masterof,

welches sind denn die Trennzeichen für die beiden Wörter? Ist es das "::"? Dann sollte es mit einem [oh]POS, Copy[/oh] einfach zu lösen sein.

Masterof 18. Dez 2004 10:33

Re: Memo in Stringgrid
 
Hallo!!
Das Problem ist bei der Sache, das es ca. 5000 Zeilen sind.

Sharky 18. Dez 2004 10:43

Re: Memo in Stringgrid
 
Zitat:

Zitat von Masterof
Hallo!!
Das Problem ist bei der Sache, das es ca. 5000 Zeilen sind.

Ich sehe da kein Problem :stupid:
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var
  ndx : Integer;
  foo : Integer;
  text : String;
begin
  StringGrid1.RowCount := Memo1.Lines.Count;
  for ndx := 0 to Pred(Memo1.Lines.Count) do
  begin
    text := Memo1.Lines[ndx];
    foo := Pos ('::',text);
    StringGrid1.Cells[1,ndx+1] := copy (text,1,foo-2);
    StringGrid1.Cells[2,ndx+1] := copy (text,foo+2,Length(text)-foo);
  end;
end;

Masterof 18. Dez 2004 11:20

Re: Memo in Stringgrid
 
ok danke hat funktioniert.

master


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:35 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz