By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,901 Members | 1,496 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,901 IT Pros & Developers. It's quick & easy.

How to share an Enum accross DLLs

P: n/a
I have some pubic Enums I like to use throughout my application. Now I'm
parsing the application out into smaller DLLs or projects. How an I share a
common Enum across all the projects?

Thanks.
--
mo*******@nospam.com
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You should be able to share the Enums if you declare them public in the Class
module before the Class statement. For ezample, in a class module or class
library, etc.

Imports ...............
Imports ..............
Public Enum myenum
First
Second
End Enum

Public Class MyClass
............
............
End Class

"moondaddy" wrote:
I have some pubic Enums I like to use throughout my application. Now I'm
parsing the application out into smaller DLLs or projects. How an I share a
common Enum across all the projects?

Thanks.
--
mo*******@nospam.com

Nov 21 '05 #2

P: n/a
"moondaddy" <mo*******@nospam.com> schrieb:
I have some pubic Enums I like to use throughout my application. Now I'm
parsing the application out into smaller DLLs or projects. How an I share
a common Enum across all the projects?


Implement the enum in one project and then add a reference to the project
from the other class library projects. Import the namespace containing the
enum and use it ;-). To add a project reference, select the project in
solution explorer and choose "Add reference..." from its context menu. In
the "Add reference..." dialog select the "Projects" tab and add the
reference.

Notice that it's important to define the enumeration only in one of the DLLs
and then use this enumeration instead of defining an enum with the same name
in each of the DLLs.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3

P: n/a
Thanks. thats what I needed.

--
mo*******@nospam.com
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"moondaddy" <mo*******@nospam.com> schrieb:
I have some pubic Enums I like to use throughout my application. Now I'm
parsing the application out into smaller DLLs or projects. How an I share
a common Enum across all the projects?


Implement the enum in one project and then add a reference to the project
from the other class library projects. Import the namespace containing
the enum and use it ;-). To add a project reference, select the project
in solution explorer and choose "Add reference..." from its context menu.
In the "Add reference..." dialog select the "Projects" tab and add the
reference.

Notice that it's important to define the enumeration only in one of the
DLLs and then use this enumeration instead of defining an enum with the
same name in each of the DLLs.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #4

P: n/a
Thanks. thats what I needed.

--
mo*******@nospam.com
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"moondaddy" <mo*******@nospam.com> schrieb:
I have some pubic Enums I like to use throughout my application. Now I'm
parsing the application out into smaller DLLs or projects. How an I share
a common Enum across all the projects?


Implement the enum in one project and then add a reference to the project
from the other class library projects. Import the namespace containing
the enum and use it ;-). To add a project reference, select the project
in solution explorer and choose "Add reference..." from its context menu.
In the "Add reference..." dialog select the "Projects" tab and add the
reference.

Notice that it's important to define the enumeration only in one of the
DLLs and then use this enumeration instead of defining an enum with the
same name in each of the DLLs.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.