Hi,
Try that.
Best regards,
Luciano
Code:
Dim my_byte_value As Byte
my_byte_value = 6 '(Any value from 0 to 255)
If my_byte_value And 1 Then
Check1.Value = 1
Else
Check1.Value = 0
End If
If my_byte_value And 2 Then
Check2.Value = 1
Else
Check2.Value = 0
End If
If my_byte_value And 4 Then
Check3.Value = 1
Else
Check3.Value = 0
End If
If my_byte_value And 8 Then
Check4.Value = 1
Else
Check4.Value = 0
End If
If my_byte_value And 16 Then
Check5.Value = 1
Else
Check5.Value = 0
End If
If my_byte_value And 32 Then
Check6.Value = 1
Else
Check6.Value = 0
End If
If my_byte_value And 64 Then
Check7.Value = 1
Else
Check7.Value = 0
End If
If my_byte_value And 128 Then
Check8.Value = 1
Else
Check8.Value = 0
End If
Below is the reverse action using the OR operation:
(Same result as my first post).
Code:
Dim my_byte_value As Byte
my_byte_value = 0
If Check1.Value = 1 Then my_byte_value = my_byte_value Or 1
If Check2.Value = 1 Then my_byte_value = my_byte_value Or 2
If Check3.Value = 1 Then my_byte_value = my_byte_value Or 4
If Check4.Value = 1 Then my_byte_value = my_byte_value Or 8
If Check5.Value = 1 Then my_byte_value = my_byte_value Or 16
If Check6.Value = 1 Then my_byte_value = my_byte_value Or 32
If Check7.Value = 1 Then my_byte_value = my_byte_value Or 64
If Check8.Value = 1 Then my_byte_value = my_byte_value Or 128
Bookmarks