Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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?

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...