Autor Beitrag
green-sound
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mi 23.04.03 16:08 
Hallo alle zusammen

ich wil mit dem hier dargestellten Quellcode 2 Proceduren aufrufen
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
begin
 ListDirs('c:\Windows\',ListBox1.Items);   //hier
 ListFiles('c:\Windows\*.*',ListBox2.Items); //und hier
end;

und bekomme folgende Fehlermeldung die ich aber nicht verstehe!
Zitat:
Die Typen der tatsächlichen und formalen Var-Parameter müssen übereinstimmen

kann mir jemand sagen was das zu bedeuten hatt?

Moderiert von user profile iconTino: Titel geändert & Topic verschoben.
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mi 23.04.03 16:12 
Tja, dann schreib doch mal die Deklaration der Prozeduren hier hin...

_________________
Ha! Es compiliert! Wir können ausliefern!
green-sound Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mi 23.04.03 16:19 
Das ganze hab ich auf folgender Seite gefunden!

www.faqsen.de/delphi...48564850495048555050
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mi 23.04.03 17:56 
Und Du hast die Prozeduren in Deinem Programm richtig eingebunden? Poste mal DEINEN Quelltext!!

_________________
Ha! Es compiliert! Wir können ausliefern!
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mi 23.04.03 19:43 
Hallo Grüne Musik!

Das liegt daran, dass in den Prozeduren TStringListen verwendet werden, aber du TStrings übergibst.
Entweder du schreibst die Prozedur um, indem du TStringList durch TStrings ersetzt, oder du machst ein Typ-Cast (oder wie das heisst). Ausserdem werden da Variablen verlangt und keine Eigenschaften. So sollte es gehen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.Button1Click(Sender: TObject);
var
  Strings: TStringList;
begin
  Strings := TStringList.Create;
  try
    Strings.Assign(ListBox1.Items);
    ListDirs('c:\Windows\', Strings);
    ListBox1.Items.Assign(Strings);
  finally
    Strings.Free;
  end;
end;
Gruß wulfskin!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.


Zuletzt bearbeitet von wulfskin am Do 24.04.03 13:30, insgesamt 1-mal bearbeitet
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 24.04.03 11:02 
Wie wulfskin schon gesagt hat würde ich den Procedure umschreiben. Ich würde allerdings den tStrings Type nehmen:
ausblenden Quelltext
1:
Procedure ListFiles(const FilePath: String; var ListBox: TStrings);					

Gruß
Tino
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Do 24.04.03 13:29 
Stimmt, es waren TStrings und nicht TItems. Danke Tino ;)!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 24.04.03 14:28 
wulfskin hat folgendes geschrieben:
Danke Tino ;)!

Immer gerne :-)

Gruß
Tino