Is there a way to combine Enums in VB.net?
I believe what you want is a flag type enum.
You need to add the Flags attribute to the top of the enum, and then you can combine enums with the 'Or' keyword.
Like this:
_
Enum CombinationEnums As Integer
HasButton = 1
TitleBar = 2
ReadOnly = 4
ETC = 8
End Enum
Note: The numbers to the right are always twice as big (powers of 2) - this is needed to be able to separate the individual flags that have been set.
Combine the desired flags using the Or keyword:
Dim settings As CombinationEnums
settings = CombinationEnums.TitleBar Or CombinationEnums.Readonly
This sets TitleBar and Readonly into the enum
To check what's been set:
If (settings And CombinationEnums.TitleBar) = CombinationEnums.TitleBar Then
Window.TitleBar = True
End If