Hi Bob,
You can use an Enumeration to check flags, but the values of the
enumerations must match the values of the flags. Flags are stored as bits,
that is binary values:
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, etc.
If you give these values to your enumerations, you can use Bitwise operators
to check them.
The following is an article about VB.Net enumerations, including Flags
enumerations:
http://aspnet.4guysfromrolla.com/articles/042804-1.aspx
For more information on VB.Net bitwise operators, see:
http://msdn.microsoft.com/library/de...ml/vaopror.asp http://msdn.microsoft.com/library/de...dxbitshift.asp http://msdn.microsoft.com/library/de...fficiently.asp
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.
"Bob Harrison" <Bo*********@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
I am monitoring some electronic equipment. Every few seconds i poll for
equipment status. The results are returned in 6 groups - like 0A 40 08 00
00
00. Currently only the first 3 bytes contain meaningful info
each bit reports either normal operation (a 0) or an error condition (a 1)
for a component of the equipment.
I set up <flag> Enum for each byte (just the first 3 bytes for now)
Enum Byte1
None=0
component1=1
component2 =2
component3 = 4
... to 128
end enum
Enum Byte2
None=0
component1=1
component2 =2
component3 = 4
... to 128
end enum
i need a routine that will quickly anaylyze and let me test the status of
each flag.
Thanks.