最简单方法,是与操作法。
比如你想判断00110011第5位的值,那么就用他和00010000做 And 逻辑运算,如果得出来的是0,那就代表这位置是0,反之为1。
函数:
Public Function XXX(src As Byte,Location As Integer) As Integer
Dim Value As Integer
Dim l as Byte = (2 ^ Location)
Value = (src And l)
Return IIF(Value=0,0,1) '如果得出来的结果是反的,那就是这里后2个参数颠倒了
End Function