Autor Beitrag
Smartie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 11:50 
Hallo,

Ich habe einen Array of Variant, und würde den Inhalt gerne in einem String ausgeben. Ich weiß aber eben nicht, welches Format genau da grad drinsteckt, ob ein Double, ein Integer oder ein String. Gibt es soetwas wie varToStr???

Herzlichen dank und Lieben Gruß

Smartie
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mi 27.04.05 12:09 
geht doch von selber:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var s: array of variant;
    i: integer;
begin
  setlength(s,3);
  s[0] := 21.65;
  s[1] := 128;
  s[2] := 'test';
  for i := 0 to length(s) - 1 do
    memo1.Lines.add(s[i]);
end;

//edit: length(s) zu length(s) - 1 korrigiert.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...


Zuletzt bearbeitet von retnyg am Mi 27.04.05 12:50, insgesamt 1-mal bearbeitet
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 12:13 
Ich dachte da an:

ausblenden Delphi-Quelltext
1:
Form1.label9.Caption := FxArr[a];					


Nur das Funktioniert nicht ganz so wie gedacht, mich wundert nur warum. ('a' wurde vorher festgelegt).

Lieben Gruß

Smartie
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 12:38 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var s: array of variant;
    i: integer;
begin
  setlength(s,3);
  s[0] := 21.65;
  s[1] := 128;
  s[2] := 'test';
  for i := 0 to length(s) do
    memo1.Lines.add(s[i]);
end;


Ähm... ich hab das meinen Bedürfnissen entsprechend ausprobiert, udn es funktioniert nicht...

Muß ich da noch was zusätzliches einbinden *ungläubig guckt*?

Lieben Gruß

Smartie
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mi 27.04.05 12:40 
ja, du musst einen button1 mit onclick prozedur und ein memo auf deine form tun.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 12:45 
user profile iconretnyg hat folgendes geschrieben:
ja, du musst einen button1 mit onclick prozedur und ein memo auf deine form tun.


Ok, hier mal mein Code, das Ding sieht so aus, Der button, sowie das Memo-feld sind bereits da:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.Button1Click(Sender: TObject);
var a : Integer;
begin
    Daten_Verarbeiten;// Ist die Prozedur in welcher Auch mein Array of Variant
                      // (ZielArray) initialisiert wird.
    for a := 1 to (L_INI_Array-1) do
    begin
      memo1.Lines.add(FxArr[a] + #09 + InttoStr(BNArr[a]) + #09 +
      InttoStr(ByteArr[a]) + #09 + FormatArr[a] + #09 + KonvertFormatArr[a]
      + #09 + ZielArray[a] + #09 + BereichsArr[a] + #09 + NamensArr[a]);
    end;

end;


Lieben Gruß

Smartie
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mi 27.04.05 12:49 
ich weiss nicht so recht was das ganze soll... probier doch mal den code aus den ich gepostet habe.
dann siehst du dass alle 3 verschiedenen werte ohne typumwandlung direkt als string ausgegeben werden.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 12:59 
Ich weiß daß DEINS läuft, und gerade deshalb wundert es mich daß MEINS NICHT läuft.

Ich weiß auch, daß MEINS läuft, wenn ich lediglich diesen Array Darstellen will:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);  
var a : Integer;  
begin  
    Daten_Verarbeiten;// Ist die Prozedur in welcher Auch mein Array of Variant  
                      // (ZielArray) initialisiert wird.  
    for a := 1 to (L_INI_Array-1) do  
    begin  
      memo1.Lines.add(ZielArray[a]);
    end;  

 
end;



Oder, wenn ich alles andere AUSSER dem Variant-Array reinnehme:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject);  
var a : Integer;  
begin  
    Daten_Verarbeiten;// Ist die Prozedur in welcher Auch mein Array of Variant  
                      // (ZielArray) initialisiert wird.  
    for a := 1 to (L_INI_Array-1) do  
    begin  
      memo1.Lines.add(FxArr[a] + #09 + InttoStr(BNArr[a]) + #09 +  
      InttoStr(ByteArr[a]) + #09 + FormatArr[a] + #09 + KonvertFormatArr[a]  
      + #09 + {hier fehlt er + #09 + } BereichsArr[a] + #09 + NamensArr[a]);  
    end;  

 
end;


Und jetzt stellt sich für mich die ernsthafte Frage, wieso er mekert, wenn ich das "gemischt" mache... Hat jemand eine Lösung?

Herzlichen Dank

Smartie
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mi 27.04.05 13:03 
darf man fragen was du mit der #9 vorhast ? das ist nämlich ein systemzeichen und hat nix in einer ausgabe verloren.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 13:10 
user profile iconretnyg hat folgendes geschrieben:
darf man fragen was du mit der #9 vorhast ? das ist nämlich ein systemzeichen und hat nix in einer ausgabe verloren.


#09 Hat da durchaus was verloren. Es bringt mir nämlich das 'tab' weil ich die nicht alle einfach wie die Karnikel aufeinander sitzen haben möchte, setze ich zwischen die einzelnen Ausgaben jeweils einen Tabulator.

Lieben Gruß

Smartie