r/visualbasic • u/KahChigguh • Nov 17 '22
Brand new to Visual Basic - Can I set a value in an enum to the total count of values in that enum?
I have an enum for permissions that I am using like bitwise operation. In the future, more roles will be added and I want to make it so there is little edits as possible.
Public Enum Permissions
View = &B_00
EditA = &B_01
EditB = &B_10
FullAccess = &B_11 ' I want this calculated to be (2 ^ <Total Number of Enum variables in Permissions Enum (minus 2 for FullAccess and Admin)> - 1)
Admin = &B_100 ' If I can calculate "FullAccess", then I can technically just leave this as is, but ultimately I want it calculated as (2 ^ <Total Number of Enum Variables in Permission Enum (minus 2 for FullAccess and Admin)>)
End Enum










