Enum question...

G

Guest

I need to declare a project level Enum that any procedure in any class can
reference so there's continuity with the values.

How do I do this?

At present, if I declare a Module in a project and want to refer to it in an
class I get the following error:

[Method] cannot expose type [Enum] outside the project through class
[ClassName]

Example:

Module Common
Public Enum icPriority As Integer
Low
Medium
High
End Enum
End Module

(Separate Class file)

Public Class Checker
Public Sub DoCheck(ByVal p as NameSpace.Common.icPriority) ' This
returns the squiggle with the error

End Sub
End Class


How do I reference the global enum in a procedure as an parameter?

Thanks,

King Wilder
 
K

Kevin Spencer

You can declare an enumeration at the namespace level, outside of any
classes or modules.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Expect the unaccepted.
 
G

Guest

Kevin,

Can you give me an example?

My question was, how to enable a single Enum to be used globally throughout
the project. I have been able to do what I want, but not using a globally
available Enum. I've had to copy the Enum into each class that I needed to
reference it.

Is there a way to use and access a single Enum to be used globally for the
project and use it in a procedure the way I described in my first post? If
so, can you present me with an example or a explanation of how to do it?


Kevin Spencer said:
You can declare an enumeration at the namespace level, outside of any
classes or modules.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Expect the unaccepted.

K. Wilder said:
I need to declare a project level Enum that any procedure in any class can
reference so there's continuity with the values.

How do I do this?

At present, if I declare a Module in a project and want to refer to it in
an
class I get the following error:

[Method] cannot expose type [Enum] outside the project through class
[ClassName]

Example:

Module Common
Public Enum icPriority As Integer
Low
Medium
High
End Enum
End Module

(Separate Class file)

Public Class Checker
Public Sub DoCheck(ByVal p as NameSpace.Common.icPriority) ' This
returns the squiggle with the error

End Sub
End Class


How do I reference the global enum in a procedure as an parameter?

Thanks,

King Wilder
 
K

Kevin Spencer

Sure King:

namespace DsiGlobal.Imaging
{
namespace Tiffs
{
/// <summary inherits="System.Int32">
/// Description of extra components.
/// </summary>
public enum ExtraSamples : int
{
/// <summary value="0">
/// Unspecified
/// </summary>
Unspecified = 0,

/// <summary value="1">
/// Associated alpha data (with pre-multiplied color)
/// </summary>
AssociatedAlpha = 1,

/// <summary value="2">
/// Unassociated alpha data
/// </summary>
UnassociatedAlpha = 2
}

// ...

}
}

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Expect the unaccepted.

K. Wilder said:
Kevin,

Can you give me an example?

My question was, how to enable a single Enum to be used globally
throughout
the project. I have been able to do what I want, but not using a globally
available Enum. I've had to copy the Enum into each class that I needed
to
reference it.

Is there a way to use and access a single Enum to be used globally for the
project and use it in a procedure the way I described in my first post?
If
so, can you present me with an example or a explanation of how to do it?


Kevin Spencer said:
You can declare an enumeration at the namespace level, outside of any
classes or modules.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Expect the unaccepted.

K. Wilder said:
I need to declare a project level Enum that any procedure in any class
can
reference so there's continuity with the values.

How do I do this?

At present, if I declare a Module in a project and want to refer to it
in
an
class I get the following error:

[Method] cannot expose type [Enum] outside the project through class
[ClassName]

Example:

Module Common
Public Enum icPriority As Integer
Low
Medium
High
End Enum
End Module

(Separate Class file)

Public Class Checker
Public Sub DoCheck(ByVal p as NameSpace.Common.icPriority) ' This
returns the squiggle with the error

End Sub
End Class


How do I reference the global enum in a procedure as an parameter?

Thanks,

King Wilder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top