Please view the MSDN page:
http://msdn2.microsoft.com/en-us/library/aa380735(VS.85).aspx
How to write the enum of days? the number(1,2... can not as variable?)
  <Flags()> _
  Enum Months
    1 = &H1
    2 = &H2
    3 = &H4
    4 = &H8
    5 = &H10
    6 = &H20
    7 = &H40
    8 = &H80
    9 = &H100
    10 = &H200
    11 = &H400
    12 = &H800
    ...
  End Enum
"Tom Shelton" <
[email protected]> 写入消æ¯
My problem
likehttp://groups.google.com/group/microsoft.public.dotnet.languages.vb/b...
But this problem seem not be sloved!
"Armin Zingler" <
[email protected]> ôÈëÃûâÃÂÎÅ:
[email protected]...
It was solved.... Â You use the And operator to test:
Option Strict On
Option Explicit On
Imports System.Text
Module Module1
  <Flags()> _
  Enum Months
    January = &H1
    February = &H2
    March = &H4
    April = &H8
    May = &H10
    June = &H20
    July = &H40
    August = &H80
    September = &H100
    October = &H200
    November = &H400
    December = &H800
  End Enum
  Sub Main()
    Dim m As Months = Months.March Or Months.MayOr Months.July
    PrintMonths(m)
  End Sub
  Sub PrintMonths(ByVal m As Months)
    Dim values() As Integer =
CType([Enum].GetValues(GetType(Months)), Integer())
    Dim buffer As StringBuilder = New StringBuilder()
    For Each value As Integer In values
      If CBool(m And value) Then
        buffer.AppendFormat("{0},",
[Enum].GetName(GetType(Months), value))
      End If
    Next
    buffer.Length = buffer.Length - 1
    Console.WriteLine(buffer)
  End Sub
End Module
HTH,