473,473 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Import a class from another project

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
6 15290
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Gagné | last post by:
Hello, My C# solution is composed of 2 projects, a class library project and a Windows application project. The window in one project calls the DLL in the other. That's ok. Now, to better test...
4
by: moondaddy | last post by:
I have a vb.net asp 1.1 project where when I step through the code behind of a page, a new codebehind with the same name appears in the IDE and executes. so now I have 2 classes open in the IDE...
2
by: Robert Gage | last post by:
Hello All Can anyone tell me in a single solution how to call a form in another project? I have a large solution made up of several projects and need to call back and forth betweem them TIA
10
by: Vik | last post by:
From a Web page, I need to open another page created in another project and pass some object (a database connetion) to that page. Looks like the second project has its own Application and Session...
4
by: Bill Nguyen | last post by:
I would like to include a module from another project. When I added existing item, VS copied the module to the current project's folder so that whatever I did to this module doesn't reflect in the...
10
by: ajtaylor | last post by:
Hello, I have a load of native C++ code that I want to use in a CLR class library. My "logic" being that I create a C++/CLI managed class that acts as an interface to the unmanged code. I...
0
by: Ramesh2006 | last post by:
Hi, The following error occurred when i programmatically compile another project from my present project. The Error: error CS0234:The type or namespace name 'Windows' does not exist in the...
3
by: Phaitour | last post by:
Hi there, I'm working on developing a large Class Library project that is slowly becoming a shared "framework" library amongst multiple applications. As this shared library grows, I need to...
3
by: Jeff | last post by:
I have a solution with two projects. Project A is the startup project, while Project B serves as the project with the data logic. At run time, the first thing I need to do is write to Project...
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
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...
0
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,...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.