Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi problem mit if ... and ... then (https://www.delphipraxis.net/23212-problem-mit-if-then.html)

herrentor 30. Mai 2004 22:11


problem mit if ... and ... then
 
warum funktioniert das nicht? es geht auch nicht, wenn "eine" zahl anstatt 3-6 schreibe. ich möchte einfach nur, dass wenn in zelle [1,i] nichts ausgewählt ist und in zeile i die spalten 3,4,5 oder 6 ungleich 0 sind, eine messeage box kommt.

Code:

if Tab.Cells[1,i] = ComboBox1.Items[-1] and Tab.Cells[i,3-6] <> 0 then
danke im voraus.

Ultimator 30. Mai 2004 22:13

Re: problem mit if ... and ... then
 
Delphi-Quellcode:
if (Tab.Cells[1,i] = ComboBox1.Items[-1]) and (Tab.Cells[i,3-6] <> 0) then
Probiers mal so (mit den Klammern)

herrentor 30. Mai 2004 22:19

Re: problem mit if ... and ... then
 
jetzt sagt er: inkompatible typen: 'string' und 'integer'

CalganX 30. Mai 2004 22:21

Re: problem mit if ... and ... then
 
Hi,
weil 0 wohl eine Zahl ist. ;) Entweder schreibst du die 0 als Strings (Hochkommata drumherum) oder du wandelst das Tab.Cells[i,3-6] per IntToStr in einen Integer um. ;)

Kommt darauf an, was du erreichen willst. :gruebel:

Chris

herrentor 30. Mai 2004 22:31

Re: problem mit if ... and ... then
 
alles klar, danke. die andere sache ist, er rechnet 3-6. ich möchte jedoch von 3 bis 6 drinstehen haben.

CalganX 30. Mai 2004 22:38

Re: problem mit if ... and ... then
 
Hi,
das musste dann einzeln schreiben:
Delphi-Quellcode:
{...}and (Tab.Cells[i,3] <> '0') and (Tab.Cells[i,4] <> '0') and {... und so weiter}
Chris

herrentor 31. Mai 2004 01:53

Re: problem mit if ... and ... then
 
ok. danke schön.

eroe 1. Jun 2004 16:42

Re: problem mit if ... and ... then
 
Hmm .. gibt es dafür nicht eine Funktion (bzw. einen Ausdruck) in Delphi mit

Delphi-Quellcode:
x in [3..6]
Nur leider wüsst ich es auf diesen Fall nicht anzuwenden :oops:

eroe

glkgereon 10. Jun 2004 17:35

Re: problem mit if ... and ... then
 
es müsste ja auch nit in einem der elemente sein, sondern in allen....

also inevery [3-6]
aber dasd gibts glaub ich nicht... :( :warn:


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:04 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz