Hi,
I have the following code which jumps over the elseif statement straight
into the second loop but does not execute it - with CB_Numeric checked,
StartValue = 10, EndValue = 5, and StepValue = -1 :
// initialize
EditField1.text = ""
dim i as Double = 0
dim StartValue as Double = Val(EF_Start.text)
dim EndValue as Double = Val(EF_End.text)
dim StepValue as Double = Val(EF_Step.text)
if EF_Step.text = "" or StepValue = 0 then
StepValue = 1
EF_Step.text = "1"
else
StepValue = Val(EF_Step.text)
end if
if CB_Numeric.value then // if numeric
if StartValue <= EndValue And StepValue >0 then // count up
for i = StartValue to EndValue step StepValue
EditField1.AppendText Str(i) + EndOfLine
next
elseif StartValue >= EndValue And StepValue <0 then // count down
for i = StartValue DownTo EndValue step StepValue
EditField1.AppendText Str(i) + EndOfLine
next
else
MsgBox "The numeric values would result in an endless loop - please
correct them"
exit
end if
else // not numeric then use the EF_Cases
MsgBox "not numeric"
end if
I can follow in the debugger that code execution is
if CB_Numeric.value then // if numeric
if StartValue <= EndValue And StepValue >0 then
// jumps over the elseif statement
for i = StartValue DownTo EndValue step StepValue
but does not execute the second loop, it just continues after the last end
if
I made a small demo at
http://ahatfullofsky.comuv.com/files/bugs/Elseif_bug.rbp.zip
Anyone can tell me where I muck this up?
Markus
Tried R2007R3 and RB2009R2
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|