Dim myValue As MyEnum = MyEnum.Value1 Or MyEnum.Value2
MessageBox.Show(myValue.ToString()) 'Displays "Value1, Value2"
If (myValue And MyEnum.Value1) = MyEnum.Value1 Then
MessageBox.Show("The composite value includes Value1.")
Else
MessageBox.Show("The composite value does not include Value1.")
End If
If (myValue And MyEnum.Value2) = MyEnum.Value2 Then
MessageBox.Show("The composite value includes Value2.")
Else
MessageBox.Show("The composite value does not include Value2.")
End If
If (myValue And MyEnum.Value3) = MyEnum.Value3 Then
MessageBox.Show("The composite value includes Value3.")
Else
MessageBox.Show("The composite value does not include Value3.")
End If
If (myValue And MyEnum.Value4) = MyEnum.Value4 Then
MessageBox.Show("The composite value includes Value4.")
Else
MessageBox.Show("The composite value does not include Value4.")
End If