Autor Beitrag
Danny87
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 688

Windows 10 Pro 64bit
Sprachen: HTML, PHP, JavaScript, Delphi || IDE: RAD Studio 10.1 Berlin Starter, WeBuilder
BeitragVerfasst: Di 26.12.06 18:57 
Hey Leute,

ich habe eine Prozedur der ich ein dynamisches Array als var-Parameter übergeben will.
Allerdings bekomme ich, wenn ich SetLength benutze die Meldung "Incompatible types".

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure GetNames(var saNames : array of string);
begin
{...}
for i:=0 to FResult.RowsCount -1 do
  begin
  SetLength(saNames,i+1); // Incompatible types
  {...}
  end;
{...}
end;


Wisst ihr woran das liegt? Wie kann ich das beheben?

Gruss
Daniel


Moderiert von user profile iconChristian S.: Topic aus Sonstiges (Delphi) verschoben am Di 26.12.2006 um 18:00
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 26.12.06 18:59 
Versuch es mal so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
type
  TStringArray = Array of String;


procedure GetNames(var saNames : TStringArray );
begin
{...}
for i:=0 to FResult.RowsCount -1 do
  begin
  SetLength(saNames,i+1); // Incompatible types
  {...}
  end;
{...}
end;


Ungetestet und ein Schuss ins Blaue ;-)

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

Windows 10 Pro 64bit
Sprachen: HTML, PHP, JavaScript, Delphi || IDE: RAD Studio 10.1 Berlin Starter, WeBuilder
BeitragVerfasst: Di 26.12.06 19:03 
Seltsam....aber so funktionierts tatsächlich :)
Warum bleibt mir ein Rätsel, aber hauptsache es geht :)

Danke :)