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.Commo n.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 3 3899
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*****@discus sions.microsoft .comwrote in message
news:FF******** *************** ***********@mic rosoft.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.Commo n.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
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*****@discus sions.microsoft .comwrote in message
news:FF******** *************** ***********@mic rosoft.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.Commo n.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
Sure King:
namespace DsiGlobal.Imagi ng
{
namespace Tiffs
{
/// <summary inherits="Syste m.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>
UnassociatedAlp ha = 2
}
// ...
}
}
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Surgery
Expect the unaccepted.
"K. Wilder" <KW*****@discus sions.microsoft .comwrote in message
news:4D******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .comwrote in message news:FF******* *************** ************@mi crosoft.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.Commo n.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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 EnumName
FirstValue = 1
SecondValue = 2
ThirdValue = 3
|
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
TOKEN t2 = 5; // compile error (cannot convert from
|
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?
Thanks in advance...
-Nikhil
|
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 references the Data layer,
but I would like to have the enum exposed to all three. Is there a way to
trickle down that enum (Like class inheritance exposes classes) so that it
can be accessed from the Business layer and UI layers? My UI layer doesn't...
|
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 understand correctly, what is actually happening on the calling side is an instance of the enum class FavoriteSport is getting created and sent to the PrintFavorite routine with a default value of type int. Is this correct? Say I have a couple hundred uses...
| |
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 and return the name "FirstData"
|
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)
|
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 snippet that I wrote today that gives me
an instant implementation of the pattern. I could easily just always
use such an implementation instead of a standard enum, so I wanted to
know what you experts all thought.
Is there a case for standard enums?
|
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 writing a program where i will have an enum in one of my classes. When the program is used, the user will define what actually goes inside the enum.
So for example what I mean is if the class is WorkDay....and the user defines what days of the weeks he or...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |