Autor Beitrag
stigge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 07.02.07 20:27 
Wie kann ich sozusagen bis sagen?
Ich möchte folgendes machen:

ausblenden Delphi-Quelltext
1:
if edit1.text = 1(bis)99 then ...					


Was muss ich anstelle von bis hinschreiben?
Mit einem Bindestrich habe ich es schon probiert.

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 07.02.07 20:32 
Hallo!

Zuerst einmal musst Du den Text in einen Zahl umwandeln (also StrToInt oder StrToFLoat). Hast Du einen ordinalen (aufzaehlbaren) Typ wie z.B. Integer oder Char hast, kannst Du sowas machen:
ausblenden Delphi-Quelltext
1:
if myInt in [1..5then					


Hast Du keinen aufzaehlbaren Typ, kannst Du es mit Vergleichen machen;
ausblenden Delphi-Quelltext
1:
if (myDouble >=1and (myDouble <= 5then					


Gruesse
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
1211chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP Pro, Win 7-64bit Home
D4 Prof
BeitragVerfasst: Mi 07.02.07 20:35 
user profile iconstigge hat folgendes geschrieben:
Wie kann ich sozusagen bis sagen?
Ich möchte folgendes machen:

if edit1.text = 1(bis)99 then ...

Was muss ich anstelle von bis hinschreiben?
Mit einem Bindestrich habe ich es schon probiert.


Fachmann bin ich auch nicht, aber willst Du die Zahlengrösse abfragen ?

if ( (zahl<?) and (zahl>?) ) then ...

_________________
Theorie: Alles läuft ... Praxis: Nix funzt ... Ich bin eben ein Mann der Praxis
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 07.02.07 20:35 
Also dann so:

ausblenden Delphi-Quelltext
1:
if edit1.text = strtoint([1...999]) then ...					



???

Und nein, ich will nur das wenn die eingegebene Zahl in edit1 zwischen 1 und 99 liegt, das ein bestimmte Varaible geändert wird.

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 07.02.07 20:39 
Du solltest Dir mal ein paar Grundlagen aneignen, zum Beispiel in meinem Crashkurs Delphi

Ich schrieb, Du musst den Text in eine Zahl umwandeln. Wo ist der Text? Hast Du Dir mal angesehen, welche Parameter StrToInt nimmt?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
1211chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP Pro, Win 7-64bit Home
D4 Prof
BeitragVerfasst: Mi 07.02.07 20:39 
if ( (zahl>?) and (zahl<?) ) then ...

natürlich genau umgekehrt. halt dich an christian, der kanns besser.

Gustl, poste niemals was nach 19 Uhr, denn du bist müde.

Sorry.

_________________
Theorie: Alles läuft ... Praxis: Nix funzt ... Ich bin eben ein Mann der Praxis
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 07.02.07 20:42 
@ 1211chef: Genau nach so einer Idee habe ich gesucht. Damit hat sich das alles hier geklärt. Danke!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 07.02.07 20:44 
Stimmt, ist was ganz anderes als in meinem Posting :zwinker:

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

WinXP
Delphi 2007
BeitragVerfasst: Mi 07.02.07 20:53 
ja, aber hab ich zuerst nicht verstanden :oops:
Gibt es eigentlich kein Wort für 'bis'?
Corpsman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 228

KUbuntu 10.4
Lazarus
BeitragVerfasst: Mi 07.02.07 20:58 
Doch gitb es das sind die 2 ..

im Interval

ausblenden Delphi-Quelltext
1:
2:
3:
if strtoint(edit1.text) in [1..99then begin
..
end;


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt

_________________
--
Just Try it.
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 07.02.07 21:41 
ausblenden Delphi-Quelltext
1:
2:
3:
if strtoint(edit1.text) in [1..99then begin
..
end;


Und das heißt jetzt, das wenn in edit1 eine zahl von bis 99 steht, das das danach ausgeführt wird?

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 07.02.07 21:54 
Ja, das heisst es. Du solltest Dir wirklich mal ein paar Tutorials durchlesen ;-)

Und bitte schau Dir mal an, wie man hier im Forum die Delphi-Tags benutzt, die habe ich ja nun schon häufiger in Deine Postings einfügen müssen. Nachlesen kannst Du das hier: www.delphi-forum.de/...ml&sub=,19,27,32

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

WinXP
Delphi 2007
BeitragVerfasst: Mi 07.02.07 22:01 
Is ja ok... :oops: