Reputation: 1
I have a number of combo boxes that do a number of things related to data. I'm struggling however with the if else and or.
I have a combo which has four items in the list YES, NO, Yes Catostrophic and Yes Controlled these relate to bleeds medically just for info.
Currently I have:
if (cbcathem.text == "yes")
lbcathem.backcolor = color.pink
Which changes the color nicely.
I have tried:
if (cbcathem.text == "yes|yes controlled")
lbcathem.backcolor = color.pink
But this does not work so, in essence, I want the label to go pink when any one of three is selected but the 4th remains untouched.
Upvotes: 0
Views: 418
Reputation: 177
You can create a static variable
static int i = 1;
And each time you click you do
i+=1;
so when arrive at i =4 you do whatever you want
Upvotes: 0
Reputation: 1290
if (cbcathem.text == "yes|yes controlled")
should be changed to
if (cbcathem.text == "yes" || cbcathem.text == "yes controlled")
Upvotes: 4
Reputation: 403
Try
if (cbcathem.text == "yes" || cbcathem.text == "yes controlled") lbcathem.backcolor = color.pink
Upvotes: 1