Is there a way to assign a binary value to a VB variable? All of the obvious choices don't work. I've tried prefixing with &B
, appending with b
but nothing seems to work. I'm not having much luck searching for it either. I don't need this for my application, but I'm rather, just curious so alternate solutions are not necessary.
[Edit] For clarification, what I was looking for (which does not appear to be possible) was how to assign a literal binary number to a variable, in a similar manner in which you can assign a hex or octal number. I was just looking for a more visually engaging way to assign values to a flag enum.
Code:
Dim num as Integer = &H100ABC 'Hex'
Dim num2 as Integer = &O123765 'Octal'
Dim myFantasy as Integer = &B1000 'What I would like to be able to do'
Dim myReality as Integer = 2 ^ 3 'What I ended up doing'