Hi Ibrahim,
I assume your bit operation works from the right-hand side. I.e., the rightmost digit of the delivery channel refers to the first check box.
Technically, you need to check which bits are ON (one) in the channel string. You don't need any enumerator for this. The simple solution is:
string DeliveryChannel = "0101";
int BinaryDeliveryChannel = Convert.ToInt16(DeliveryChannel, 2);
checkbox1.visible = (1 & BinaryDeliveryChannel) > 0;
checkbox2.visible = (1 & BinaryDeliveryChannel >> 1) > 0;
checkbox3.visible = (1 & BinaryDeliveryChannel >> 2) > 0;
checkbox4.visible = (1 & BinaryDeliveryChannel >> 3) > 0;
What happens here is you are moving your desired bit to the right-hand side and checking if it is ON by bitwise AND-ing with 1.
Your first bit doesn't need a shifting. The operation performs as:
0001 - for 1<br />
0101 - for the channel mask<br />
-----<br />
0001 - Result of the bitwise AND
Thus, the result is one, and would designate the first checkbox ON.
To check the second bit you need to move it one bit right. So 0101 becomes 0010. That is, the desired bit of the delivery channel mask (second from right), moves to the rightmost position. The operation performs as:
0001 - for 1<br />
0010 - for the channel mask right-shifted one bit<br />
-----<br />
0000 - Result of the bitwise AND
Thus, the bitwise AND is zero, and hence would designate that, the second checkbox will not be visible.
And so on... Hope this helps.