C
Clif McIrvin
Hi all ---
I'm thinking of putting the .Tag property to use by using a binary
("bitwise") encoded flag word. Over time I've come across different
possible uses for .Tag but have never standardized how I use it.
Has someone developed a convention for "parsing" binary flag words? A
simple IF works if I only need to test for one flag, but if I need to
check for the presence of multiple bits the only construct that comes to
mind is a series of IF statements .... something along the lines of:
Enum FlagWord
FlagA = 1
FlagB = 2
FlagC = 4
....
End Enum
Dim vFlags as FlagWord
'validation and error handling omitted for simplicity
vFlags = Me.ctlx.Tag
IF vFlags AND FlagA then
'do something
EndIF
If vFlags AND FlabB then
'do something else
EndIf
If vFlags AND FlabC then
'do a different thing
EndIf
I'm thinking of putting the .Tag property to use by using a binary
("bitwise") encoded flag word. Over time I've come across different
possible uses for .Tag but have never standardized how I use it.
Has someone developed a convention for "parsing" binary flag words? A
simple IF works if I only need to test for one flag, but if I need to
check for the presence of multiple bits the only construct that comes to
mind is a series of IF statements .... something along the lines of:
Enum FlagWord
FlagA = 1
FlagB = 2
FlagC = 4
....
End Enum
Dim vFlags as FlagWord
'validation and error handling omitted for simplicity
vFlags = Me.ctlx.Tag
IF vFlags AND FlagA then
'do something
EndIF
If vFlags AND FlabB then
'do something else
EndIf
If vFlags AND FlabC then
'do a different thing
EndIf