![]() |
Anfängerhilfe -> if bedingung
Hi,
Erstmall toll das man hier Hilfe bekommen kann :thumb: Naja mein Problem versteh ich selbst nich so ganz, sollte eigentlich funken, tuts aber nich!
Delphi-Quellcode:
Die i = ListBox2.Items.Count bedingung wird erfüllt. Diese soll unabhängig von den beiden anderen Bedingungen sein.
if (i = ListBox2.Items.Count -1) or ((not StrToInt(ComboBox2.Text) = 0) and (StrToInt(ComboBox2.Text) = h)) then ...
Bei der anderen handelt es sich um ein auswählbaren Wert in der Combobox zwischen 0 und 10. Die Bedingung soll aber nur erfüllt werden wenn die Variable h den Wert in der Combobox entspricht und dieser auch nicht 0 ist. Ich habe mir den Wert ComboBox2.Text und h schon in einer Listbox ausgeben lassen, h überschreitet einfach den Combobox wert ohne das die Bedingung erfüllt wird. Hoffe ich bin nich allzu doof dafür :o greetz Sannes |
Re: Anfängerhilfe -> if bedingung
If verstehe nicht ganz, wann die Bedingung war sein soll
Soll die 1. Bedingung nund eine der anderen wahr sein? |
Re: Anfängerhilfe -> if bedingung
not ist nicht nur ein Operator für Booleanwerte, sondern auch für Integer.
Dort bildet not die bitweise Negation. Um das zu vermeiden, benutze entweder eine Klammer mehr:
Delphi-Quellcode:
oder vergleiche anders und lass not weg:
if (i = ListBox2.Items.Count -1) or ((not (StrToInt(ComboBox2.Text) = 0)) and (StrToInt(ComboBox2.Text) = h)) then
Delphi-Quellcode:
if (i = ListBox2.Items.Count -1) or ((StrToInt(ComboBox2.Text) <> 0) and (StrToInt(ComboBox2.Text) = h)) then
Ich hoffe, ich habe richtig verstanden, was du willst :mrgreen: |
Re: Anfängerhilfe -> if bedingung
Zitat:
|
Re: Anfängerhilfe -> if bedingung
Zitat:
Delphi-Quellcode:
if (i = ListBox2.Items.Count - 1) or ((h <> 0) and (StrToInt(ComboBox2.Text) = h)) then
|
Re: Anfängerhilfe -> if bedingung
Die Jungs haben es völlig vergessen...
herzlich willkommen in der DP :dp: PS: daß du if Bedingung geschrieben hast und nicht if.... (ich sags lieber nicht sonst muß ich ein :cheers: ausgeben) ist :thumb: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:58 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz