Autor Beitrag
Necator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: Mo 06.12.04 19:14 
Hi leutz,
kann man am anfang eines befehls was definiren z.B. i:integer und dann später sagen:
if Edit1.Text=i then...
NEIN kann man so einfach leider nicht zumindest nicht in exact der form! kann mir jemand sagen wie ich das verarbeiten muss?

_________________
Ich bin nicht auf der Welt um so zu sein wie andere mich gere hätten!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 06.12.04 19:18 
if (Edit1.Text = IntToStr(i)) then
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mo 06.12.04 19:19 
Servus

Suche in: Delphi-Forum, Delphi-Library ANFÄNGERTUTORIAL Suche bei Google ANFÄNGERTUTORIAL DELPHI

Also die Eigenschaft des Edits, die den Text an speichert (also edit1.text) ist vom Typ String.
Die Variable die du deklariert hast ( i : integer) ist vom Typ integer. Du brauchst eine Typenumwandlung um diese beiden Typen vergleichen zu können.

So kann das dann z.B. aussehen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
 I : integer;
begin
 i := 5;
 if edit1.text = inttostr(i) then showmessage('Die Zahl ist 5');
end;


So geht's natürlich auch:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
 i : string;
begin
 i := '5';
 if edit1.text = i then showmessage('sdfsdF');
end;


Zuletzt bearbeitet von Karlson am Mo 06.12.04 21:05, insgesamt 1-mal bearbeitet
Necator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: Mo 06.12.04 19:22 
danke leutz und au danke für den link werd ich mir mal anschaun wenn ich für den elefant zeit hab^^