Autor Beitrag
patrick dee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Fr 30.12.05 12:07 
Hi Leute.

Zu meinem Problem. Habe zwei ListBoxen. In der Listbox1 steht eine Playliste mit div. Titeln. In der ListBox2 stehen die Titel drinen die meine Wave Player aus der Liste gespielt hat. Nun möchte ich einen Button drücken und ListBox1 soll mir alle Titel anzeigen die nicht gespielt worden sind, und dann als zb. 30-12-05.tbw speichern.

So das ich am Ende wenn ich die 30-12-05.tbw öffne sehen kann, welche Titel nicht aus der Playliste gespielt wurden.

Kann mir jemand da etwas weiterhelfen wie ich das hinbekommen kann ?

DANKE und einne guten rutsch ins Neue Jahr

Patrick

_________________
Glauben heißt nichts wissen ...
stifflersmom
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 194

XP /XP PRO/ SuSE div.
D1 - D7, BDS 2006
BeitragVerfasst: Fr 30.12.05 13:04 
Nimm eine dritte ListBox.

ausblenden Delphi-Quelltext
1:
2:
3:
for I := 0 to ListBox1.count -1 Do
  If Pos(Listbox1[i],ListBox2.Items.Text) = 0 Then      // Gibt es den eintrag in der 2. Listbox
   ListBox3.Items.Add(ListBox1.Items[i]);               // wenn nicht, dann ab damit in die dritte


Und so stehen in der dritten ListBox alle die Einträge,
aus der ersten die NICHT in der zweiten zu finden sind.

Moin
patrick dee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Fr 30.12.05 13:34 
Habe es so :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.btnAuswertungManuellClick(Sender: TObject);
var
I : Integer;
begin
for I := 0 to ListBox1.count -1 Do
  If Pos(Listbox1[i],ListBox2.Items.Text) = 0 Then      // Gibt es den eintrag in der 2. Listbox
   Form3auswertung.ListBox3.Items.Add(ListBox1.Items[i]); // wenn nicht, dann ab damit in die dritte

end;



aber Delphi6 meckert bei der Zeile : If Pos(Listbox1[i],ListBox2.Items.Text) = 0 Then

was habe ich falsch gemacht ???

Patrick

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt

_________________
Glauben heißt nichts wissen ...
Jailbird
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 127

Windows XP Pro SP2
Delphi 7 Professional
BeitragVerfasst: Fr 30.12.05 14:00 
Für was eine 3. Listbox? Geht doch auch mit 2. In ListBox2 stehen die Einträge, welche aus ListBox1 verschwinden müssen. Et voilà

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  k, i: Integer;
begin
  for k := ListBox2.Items.Count - 1 downto 0 do
  begin
    i := ListBox1.Items.IndexOf(ListBox2.Items[k]);
    if i > -1 then ListBox1.Items.Delete(i);
  end;
  ListBox1.Items.SaveToFile('items.txt');
end;
stifflersmom
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 194

XP /XP PRO/ SuSE div.
D1 - D7, BDS 2006
BeitragVerfasst: Fr 30.12.05 15:07 
user profile iconpatrick dee hat folgendes geschrieben:
Habe es so :

procedure TForm1.btnAuswertungManuellClick(Sender: TObject);
var
I : Integer;
begin
for I := 0 to ListBox1.count -1 Do
If Pos(Listbox1[i],ListBox2.Items.Text) = 0 Then // Gibt es den eintrag in der 2. Listbox
Form3auswertung.ListBox3.Items.Add(ListBox1.Items[i]); // wenn nicht, dann ab damit in die dritte

end;


aber Delphi6 meckert bei der Zeile : If Pos(Listbox1[i],ListBox2.Items.Text) = 0 Then

was habe ich falsch gemacht ???

Patrick


Uuups, mein Fehler
ich habe die Items "nichtgetippt"
Die Zeile mit dem Pos muss korrekt so heißen
ausblenden Delphi-Quelltext
1:
If Pos(Listbox1.Items[i],ListBox2.Items.Text) = 0 Then					


Moin