enum question

  • Thread starter Thread starter Julia Sats
  • Start date Start date
J

Julia Sats

Hi,
I have such enum at module modMain:

Public Enum enmProcesses As Integer
DBPart = 0
FilePart = 1
Backout = 2
End Enum

when I use enum at code I need do like it :

dim intProcess as enmProcesses
.....................
Select Case intProcess
Case modMain.enmProcesses.DBPart
' code here
Case modMain.enmProcesses.FilePart
'code here
Case modMain.enmProcesses.Backout
'code here
End Select

What I need change for having such code - without name of the module and
enum:
Select Case intProcess
Case DBPart
' code here
Case FilePart
'code here
Case Backout
'code here
End Select

Thanks,
 
Julia,
What I need change for having such code - without name of the module and
enum:

The Enum name is required part of the enum label, as the Enum value
represents a distinct type.

However! if you move the Enum outside the Module you can drop the module
name.

If you want to use just DBPart, then you may want to consider Integer
constants as opposed to an Enum.
Public Enum Processes As Integer
DBPart = 0
FilePart = 1
Backout = 2
End Enum

Public Module MainModule
End Module

dim process as Processes
....................
Select Case process
Case Processes.DBPart
' code here
Case Processes.FilePart
'code here
Case Processes.Backout
'code here
End Select

For the recommended naming of Enums see:
http://msdn.microsoft.com/library/d...html/cpconEnumerationTypeNamingGuidelines.asp

Hope this helps
Jay
 
Back
Top