Autor Beitrag
majolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Mi 18.09.02 19:35 
Leider, konnte ich mein Problem nicht lösen.Ich möchte gerne Wörter aus einem Text in eine Listbox hinzufügen.Das ist auch nicht das Problem.Nun möchte ich aber das getestet wird, ob das Wort schon vorhanden ist.Wenn ja soll zum Wort also: Wort+[Zahl wie oft vorhanden]. Also ,wenn das Wort zum ersten mal hinzugefügt wird soll die Klammer nicht erscheinen.Erst wenn das Wort zum zweiten mal dazukommt, soll die Klammer hinzukommen.Beispiel: Wort ---> Wort[2]----> Wort[3]----> Wort[4] usw.
Aus diesem Grund habe ich vor Tagen Listbox suchen Thread geöffnet, aber leider nur mit Suchen bin ich nicht weiter gekommen.Sorry für den neuen Thread.Hoffe ist verständlich.
Kann mir einer ein Code BSP posten?
Danke im vorraus.
majolo
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 18.09.02 21:54 
Hi!

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject);
VAR index_alt, index_neu, anzahl : INTEGER;
    suchtext : String;
begin
  index_neu:=-1;
  anzahl:=0;
  suchtext:='d';
  repeat
    index_alt:=index_neu;
    index_neu:=SendMessage(ListBox1.Handle,LB_FindString,index_alt,lParam(suchtext));
    if index_neu>index_alt then inc(anzahl);
  until index_neu<=index_alt;
  edit1.text:=IntToStr(anzahl);
end;


Dieser Code schreibt in edit1.text die Anzahl des in der Variable "suchtext" gespeicherten Textes. Den für Dein Problem abzuwandeln sollte ja kein Problem sein.

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Do 19.09.02 16:10 
Danke Peter.Werde ich umwandeln.
Gruss
majolo