473,804 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ 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 15416
On Sep 11, 8:01 am, ffre...@gmail.c om 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.c om 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.T ay...@gmail.com >
wrote:
On Sep 11, 1:01 pm, ffre...@gmail.c om 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
DeviceApplicati on and the other one is a WindowsApplicat ion 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.c om wrote:
On 11 sep, 15:40, Phillip Taylor <Phillip.Ross.T ay...@gmail.com >
wrote:


On Sep 11, 1:01 pm, ffre...@gmail.c om 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
DeviceApplicati on and the other one is a WindowsApplicat ion 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...@construct ion-imaging.com wrote:
On Sep 11, 10:23 am, ffre...@gmail.c om wrote:
On 11 sep, 15:40, Phillip Taylor <Phillip.Ross.T ay...@gmail.com >
wrote:
On Sep 11, 1:01 pm, ffre...@gmail.c om 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
DeviceApplicati on and the other one is a WindowsApplicat ion 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
2221
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 the solution I would like to create a new Windows application project in that solution so that my 2 other projects are not impacted by this third project. Now this new project would contain the startup Form from which I could open my Form in the...
4
1347
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 with the same name (BasePage.aspx.vb) I had another project open at the same time which has a page with the same name (BasePage.aspx) and somehow it got pulled into the first project. Even after I close both projects and re-open the first one...
2
5904
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
1456
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 states. Thanks.
4
10504
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 original module. this is NOT what I expected. Is there a way to share a module (.vb) among multiple projects? Thanks Bill
10
2406
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 created a new CLR class library and added my native/unmanaged C++ code then added some code to the unmanaged class. Now, and this is where I am not sure, I turned off the CLR support in
0
1775
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 namespace 'System' <are you missing an assembly reference> The Source Code:
3
2781
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 start thinking about ways to split this library up. In observing the .net framework, I've noticed that each major branch of the framework (eg. System.Net or System.Data) and even some of the minor branches are split up into individual dlls. When...
3
13672
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 B's app.config. I've referenced System.configuration.dll within Project B, and from one of the classes inside Project B's namespace, I'm trying to use ConfigurationManager to write to its app.config. Unfortunately, it only finds Project A's...
0
9714
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
10350
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
10351
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
10096
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
9174
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
7638
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
5534
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3834
muto222
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.