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

Import a class from another project

P: n/a
Hi,
I have a Solution with two different Projects.
In one project, can I import a class from another project?
It's something like:

Solution mySolution
ProjectA
Class A1
ProjectB
Class B1

How can I create a ClassB1 object in ClassA1? Is it possible?
Thanks.

Sep 11 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Sep 11, 8:01 am, ffre...@gmail.com wrote:
Hi,
I have a Solution with two different Projects.
In one project, can I import a class from another project?

It's something like:

Solution mySolution
ProjectA
Class A1
ProjectB
Class B1

How can I create a ClassB1 object in ClassA1? Is it possible?

Thanks.
If ProjectB is a Class Library, just include it's output as a
reference to ProjectA.

Sep 11 '07 #2

P: n/a
On Sep 11, 1:01 pm, ffre...@gmail.com wrote:
Hi,
I have a Solution with two different Projects.
In one project, can I import a class from another project?

It's something like:

Solution mySolution
ProjectA
Class A1
ProjectB
Class B1

How can I create a ClassB1 object in ClassA1? Is it possible?

Thanks.
Yes, go "Add References" from the project menu (while first project is
selected) and choose the "Projects" tab. Make sure you class is
declared

Public Class A1

Then you can do ProjectB.A1 = new .... etc etc

Sep 11 '07 #3

P: n/a
On 11 sep, 15:40, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
On Sep 11, 1:01 pm, ffre...@gmail.com wrote:
Hi,
I have a Solution with two different Projects.
In one project, can I import a class from another project?
It's something like:
Solution mySolution
ProjectA
Class A1
ProjectB
Class B1
How can I create a ClassB1 object in ClassA1? Is it possible?
Thanks.

Yes, go "Add References" from the project menu (while first project is
selected) and choose the "Projects" tab. Make sure you class is
declared

Public Class A1

Then you can do ProjectB.A1 = new .... etc etc
Thanks a lot.
It works... but there is a problem because one project is a
DeviceApplication and the other one is a WindowsApplication so I get
an error message when I try "Add References" Class I trying to import
is a basic class (only a bunch of properties)
Sep 11 '07 #4

P: n/a
On Sep 11, 10:23 am, ffre...@gmail.com wrote:
On 11 sep, 15:40, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:


On Sep 11, 1:01 pm, ffre...@gmail.com wrote:
Hi,
I have a Solution with two different Projects.
In one project, can I import a class from another project?
It's something like:
Solution mySolution
ProjectA
Class A1
ProjectB
Class B1
How can I create a ClassB1 object in ClassA1? Is it possible?
Thanks.
Yes, go "Add References" from the project menu (while first project is
selected) and choose the "Projects" tab. Make sure you class is
declared
Public Class A1
Then you can do ProjectB.A1 = new .... etc etc

Thanks a lot.
It works... but there is a problem because one project is a
DeviceApplication and the other one is a WindowsApplication so I get
an error message when I try "Add References" Class I trying to import
is a basic class (only a bunch of properties)
If you have one or more classes that need to be shared by multiple
projects, you MUST put those classes in a ClassLibrary project and add
that project's output as a reference to any other project that needs
to reference any of the classes in it.

Sep 11 '07 #5

P: n/a
Ok thanks.
I have to try it.

On 11 sep, 18:25, za...@construction-imaging.com wrote:
On Sep 11, 10:23 am, ffre...@gmail.com wrote:
On 11 sep, 15:40, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
On Sep 11, 1:01 pm, ffre...@gmail.com wrote:
Hi,
I have a Solution with two different Projects.
In one project, can I import a class from another project?
It's something like:
Solution mySolution
ProjectA
Class A1
ProjectB
Class B1
How can I create a ClassB1 object in ClassA1? Is it possible?
Thanks.
Yes, go "Add References" from the project menu (while first project is
selected) and choose the "Projects" tab. Make sure you class is
declared
Public Class A1
Then you can do ProjectB.A1 = new .... etc etc
Thanks a lot.
It works... but there is a problem because one project is a
DeviceApplication and the other one is a WindowsApplication so I get
an error message when I try "Add References" Class I trying to import
is a basic class (only a bunch of properties)

If you have one or more classes that need to be shared by multiple
projects, you MUST put those classes in a ClassLibrary project and add
that project's output as a reference to any other project that needs
to reference any of the classes in it.

Sep 12 '07 #6

P: n/a
If you are a hobbiest like me and will only use the class in a couple of
projects, then I like "Cut and Paste"!
--
Dennis in Houston
"ff*****@gmail.com" wrote:
Hi,
I have a Solution with two different Projects.
In one project, can I import a class from another project?
It's something like:

Solution mySolution
ProjectA
Class A1
ProjectB
Class B1

How can I create a ClassB1 object in ClassA1? Is it possible?
Thanks.

Sep 16 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.