473,796 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Same Enum with different values depending of the project

Hi, is it possible to create a project that can offer
different members of a Public Enum according to a
condition ?

I mean, Project A has a public enum.
Project B & C access A's enum. However B should see some
elements of the enum while C should see others...

Is this achievable ??

Thanks a lot,
Alan.
Nov 21 '05 #1
3 1489
AFAIK, you cannot do that. Any particular reason you would want to do that?
Maybe there's some other way to achieve what you want to do. A little more
detail would certainly help.

Imran.

"Alan" <an*******@disc ussions.microso ft.com> wrote in message
news:0d******** *************** *****@phx.gbl.. .
Hi, is it possible to create a project that can offer
different members of a Public Enum according to a
condition ?

I mean, Project A has a public enum.
Project B & C access A's enum. However B should see some
elements of the enum while C should see others...

Is this achievable ??

Thanks a lot,
Alan.

Nov 21 '05 #2
"Imran Koradia" wrote:
AFAIK, you cannot do that. Any particular reason you would want to do that?
Maybe there's some other way to achieve what you want to do. A little more
detail would certainly help.

Imran.


Well, what i'm trying to accomplish is the following:

To have a custom control with an enum property where the enum property
coincides with a value on the database. The custom control will use the enum
value selected to retrieve child values from the database. So the control
cares not about the description of the enum, it just uses the number.

So the idea is to be able to provide this descriptions according to the
project i'm using this custom control from.

If i'm using the control from project A then the enum should be:

public enum myenum
enumval0 = 0
enumval1 = 1
enumval2 = 2
end enum

and if from project B:

public enum myenum
otherval0 = 0
otherval1 = 0
otherval2 = 0
end enum

This is just to be able to use the control from different projects and give
the developer the intellisense functionality provided by enums
Nov 21 '05 #3
I don't quite understand why you would want to do that. One thing is for
sure that you cannot assign different values to enums - they are effectively
constants that cannot be changed. The only thing I can think of is defining
multiple enums.

Imran.

"Alan" <Al**@discussio ns.microsoft.co m> wrote in message
news:4E******** *************** ***********@mic rosoft.com...
"Imran Koradia" wrote:
AFAIK, you cannot do that. Any particular reason you would want to do that? Maybe there's some other way to achieve what you want to do. A little more detail would certainly help.

Imran.

Well, what i'm trying to accomplish is the following:

To have a custom control with an enum property where the enum property
coincides with a value on the database. The custom control will use the

enum value selected to retrieve child values from the database. So the control
cares not about the description of the enum, it just uses the number.

So the idea is to be able to provide this descriptions according to the
project i'm using this custom control from.

If i'm using the control from project A then the enum should be:

public enum myenum
enumval0 = 0
enumval1 = 1
enumval2 = 2
end enum

and if from project B:

public enum myenum
otherval0 = 0
otherval1 = 0
otherval2 = 0
end enum

This is just to be able to use the control from different projects and give the developer the intellisense functionality provided by enums

Nov 21 '05 #4

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

Similar topics

3
3120
by: Waqas Pitafi | last post by:
Hi, I have a table with the data like this, ID Status Description 1 R Read 2 U UnRead D D Deleted I want to load this data in a class (say named Status) which I want to use
3
2165
by: Kenneth | last post by:
I want to define an enum for possible languages in my application. My enum look like this: Public Enum Languages English = 0 Portuguese = 1 End Enum How can i reuse this enum in the rest of my application (in different classes in different projects)?
12
3428
by: Steven T. Hatton | last post by:
Any opinions or comments on the following? I don't say it below, but I came out on the side of using enumerations over static constants. /* I'm trying to figure out the pros and cons of using static const * int class members as opposed to using enumerations to accomplish a * similar goal. The use of static constants seems more explicit and * obvious to me. Unless I assign values to the enumerators, the * compiler will do it for me....
3
16078
by: Richard | last post by:
Okay gang, This should be simple but apparently it's not... I want to use the System.DayOfWeek enum to create and access an array of objects with one object for each day of the week. I'd like the array declaration to be strongly typed to the enum and I'd like to use the enum to access entries in the array. I'd like to write code something like this: #using System;
1
3262
by: Jim Hart | last post by:
Hi all! Can anyone explain this one to me. . . I have a 'Util' namespace with a 'Common' class that contains consts & values I use throughout multiple projects. One of the members of this 'Common' class is an enum like so: public class Common { ....
13
12394
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)
3
3907
by: K. Wilder | last post by:
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: cannot expose type outside the project through class
5
3440
by: thetrueaplus | last post by:
Hey all. I have bit shifted my enum values all the way to 31 items. I feel that this api that i am using continues to grow, i will be stuck with out any more items in my enum. I would like to promote the enum to a long if possible so that it will be 64 bits long. Thanks.
3
1290
by: Ralfeus | last post by:
Hi all Oftenly I need to use enums but standard C# enums provide little bit poor possibilities. For example I'd like to restrict variables to get only values specified in enums. Also sometimes I want to implement some type conversion from enum to some other type. Is it possible to create a new type, which would extend an enum? Thanks
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10217
jinu1996
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...
1
10168
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,...
0
10003
tracyyun
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...
0
9047
agi2029
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...
1
7546
isladogs
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...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
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 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.