473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Enum question...

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
Aug 6 '06 #1
3 3886
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" <KW*****@discussions.microsoft.comwrote in message
news:FF**********************************@microsof t.com...
>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

Aug 7 '06 #2
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" wrote:
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" <KW*****@discussions.microsoft.comwrote in message
news:FF**********************************@microsof t.com...
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


Aug 8 '06 #3
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" <KW*****@discussions.microsoft.comwrote in message
news:4D**********************************@microsof t.com...
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" wrote:
>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" <KW*****@discussions.microsoft.comwrote in message
news:FF**********************************@microso ft.com...
>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



Aug 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum...
10
by: James Brown | last post by:
I have the following enum declared: enum TOKEN { TOK_ID = 1000, TOK_NUMBER, TOK_STRING }; (it goes on and on like that) This is what I would like to do: TOKEN t1 = TOK_ID; // ok...
4
by: Nikhil Patel | last post by:
Hi all, I am a VB6 programmer and learning C#. I am currently reading a chapter on types. I have question regarding enums. Why do we need to convert enum members to the value that they represent?...
5
by: Andrea Williams | last post by:
I'm working with C# and I'm setting up some ENUM's I have a data and Business layer. I'm declaring a common enum for the Data Layer. The UI layer references the Bus layer and the bus layer...
6
by: Michael Isaacs | last post by:
Regarding use of enum's, I am wondering what the cost of memory is when creating the enumeration on the calling side, and then using it on the function/method side. See example below. If I...
2
by: Dennis | last post by:
I have an enum as follows: Public Enum myData FirstData = 6 SecondData = 7 end enum Is there anyway that I can return the Enum names by their value, i.e., I want to input 6 into a function...
13
by: Don | last post by:
How do I get an Enum's type using only the Enum name? e.g. Dim enumType as System.Type Dim enumName as String = "MyEnum" enumType = ???(enumName)
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
4
by: ice8595 | last post by:
Hi there, I'm fairly new at this, and I am having a bit of trouble wrapping my head around some concepts of enum for a project. So any help would be greatly appreciated. Essentially I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.