Using Flags In My Function as Parameter (OR usage?)

ChubbyArse

Newcomer
Joined
Jun 10, 2003
Messages
19
Hi All,

I want to do something like the flags property in the old commondialog.

Where you used the OR to specifiy the options, I'd like to build the same into my function call.
How do I do this.

For example:

Dim lng As Long
lng = 1 Or 2

How do I establish that lng contains 1 and 2?

What is this technique described as in vb.net, and where would I be able to read up on it?

Thanks

Alex
 
Am I able to use the FlagsAttribute when my enum is numbers as such????

<FlagsAttribute()> Public Enum CustomCCItemType As Long

Drawing = 1
PNumber = 2
ConsumablePNumber = 3
RepairSalvageDrawing = 4
ProcurementDS = 5
LOP = 6
WeightReport = 7
Modification = 8
Amendment = 9
MagneticTape = 10
DesignSpecification = 11
ToolDrawing = 12
TestRig = 13
TestRigDrawing = 14
StandardPart = 15

End Enum

The reason they are numbered is that they correspond to a reference key in a table which I want to build a search SQL string for.

What I am reading is that a flags enum has to be numbered 1,2,4,8,16 etc......

In that case, how can I use this enum as a flag?
 
Flags are really just bit fields behind the scenes so the powers of 2 numbering is required for exclusive options.
Using your example of
Drawing = 1
PNumber = 2
ConsumablePNumber = 3

ConsumablePNumber would logically be the combiniation of Drawing and PNumber - probably not how your logic works.

It may be easier to declare your function as taking an array of options and passing multiple values in that way.
 
Back
Top