I am updating an some old code to be compatible with some newer applications and I came across the following code:
'Display I/O Status
IOState = get_io_status()
For TestBit = 0 To 11
If 2 ^ TestBit And IOState Then
T_IOState(TestBit).BackColor = System.Drawing.ColorTranslator.FromOle(&HFF00)
Else
T_IOState(TestBit).BackColor = System.Drawing.ColorTranslator.FromOle(&HFF)
End If
Next TestBit
This is how the previous programmer was storing different booleans (in a short). For the purposes of our new software I would much rather have them stored in an array.
How can I get the booleans out of the short and into an array?
Can someone please explain what is happening in this code with the
If 2 ^ TestBit And IOState
I dont understand how it works