Forum > Beginners

About case block

(1/5) > >>

ariben:
I wrote this simple case block but this 'AND' (or 'and') is never assigned to the valuable Oprt1 in this case.
Does anyone reproduce this ?

procedure TForm1.RadioGroup1Click(Sender: TObject);

begin
    case RadioGroup1.ItemIndex of
     0: Oprt1 := 'AND';
     1: Oprt1 := 'OR';
     2: Oprt1 := 'AND NOT';
    end;
end;   

marcov:
Maybe you need to set some initial value to force always assignment? Hard to tell with so little code.

ariben:
Thank you,
But this is all. ShowMessage(Oprt1) always returns empty even when I check the 0(AND)
I tried to set default value to -1 or 0, all the same.

dseligo:
Try attached project if it works ok for you.
Just click on radio buttons.

ariben:
Thank you,
OMG! It works. What is the difference between yours and mine?

I will check twice properties of myown form and reply.

Navigation

[0] Message Index

[#] Next page

Go to full version