FlagsAttribute Indicates that an enumeration can be treated as a bit field; that is, a set of flags.
Imports System
Imports Microsoft.VisualBasic
Module FlagsAttributeDemo
Enum SingleHue as Short
Black = 0
Red = 1
Green = 2
Blue = 4
End Enum
<FlagsAttribute( )> _
Enum MultiHue as Short
Black = 0
Red = 1
Green = 2
Blue = 4
End Enum
Sub Main( )
Dim val as Integer
For val = 0 to 8
Console.WriteLine( "{0,3} - {1}",val, CType( val, SingleHue ).ToString( ) )
Next val
For val = 0 to 8
Console.WriteLine( "{0,3} - {1}", _
val, CType( val, MultiHue ).ToString( ) )
Next val
End Sub
End Module
Related examples in the same category