473,395 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Multiple projects in one C# solution

Hi all

I'm creating a Contact Management System. I have added one console project
and various window projects (for the user interfaces) to the solution.
I've added these as obviously there will multiple GUI's and I want to store
all the generic classes in the console project I've added.
Firstly, is this how you are meant to go about things to achieve my above
thinking/aim?

Secondly, in a window project's Button_Click event how do I create an
object of a class that is stored in the console project? - How do I fully
qualify it? - i.e. ConsoleName.NamespaceName.ClassName temp = new
ConsoleName.NamespaceName.ClassName();

Does anybody know of any links that explain would the above to me as my C#
books do not explain this?

Any help would be very much appreciated.
Jon (A newcomer to C#).

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #1
7 9104
Hello, Jon!

JvD> Hi all

JvD> I'm creating a Contact Management System. I have added one console
JvD> project and various window projects (for the user interfaces) to the
JvD> solution. I've added these as obviously there will multiple GUI's and
JvD> I want to store all the generic classes in the console project I've
JvD> added. Firstly, is this how you are meant to go about things to
JvD> achieve my above thinking/aim?

You should create Class Library project to store all functionality.
After that you can use classes from this project in other, by doing sme
steps;
- add reference to this project (in AddReference Dialog choose Projects
tab) and add reference to class library project
- you can use all functionality from this library by full name
YouLibraryNamespace.YourClass
or with directive using (using YouLibraryNamespace; ..... /*somewhere in
code*/ YourClass youClass = new YourClass();)

- if you need use this functionality in console project, the steps will be
the same.

JvD> Secondly, in a window project's Button_Click event how do I create an
JvD> object of a class that is stored in the console project? - How do I
JvD> fully qualify it? - i.e. ConsoleName.NamespaceName.ClassName temp =
JvD> new ConsoleName.NamespaceName.ClassName();

see above

JvD> Does anybody know of any links that explain would the above to me as
JvD> my C# books do not explain this?

msdn.microsoft.com :)

JvD> Any help would be very much appreciated.
JvD> Jon (A newcomer to C#).

JvD> --
JvD> Message posted via http://www.dotnetmonster.com

With best regards, Dmitry Rutcovsky. E-mail: da***@ukr.net
Nov 17 '05 #2
Hi Dmitry, I shall look into this. Thanks Jon.

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #3
It sounds as though what you want to do is create a DLL project that's used
by the other projects in the solution.

Create a class library project for your utility classes and then ad a
reference to that project in an GUI projects in the same solution.

A console application is the wrong choice but I'm sure you can shift the
utilities to a DLL class library with minimal problems.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jon via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:4c******************************@DotNetMonste r.com...
Hi all

I'm creating a Contact Management System. I have added one console
project
and various window projects (for the user interfaces) to the solution.
I've added these as obviously there will multiple GUI's and I want to
store
all the generic classes in the console project I've added.
Firstly, is this how you are meant to go about things to achieve my above
thinking/aim?

Secondly, in a window project's Button_Click event how do I create an
object of a class that is stored in the console project? - How do I fully
qualify it? - i.e. ConsoleName.NamespaceName.ClassName temp = new
ConsoleName.NamespaceName.ClassName();

Does anybody know of any links that explain would the above to me as my C#
books do not explain this?

Any help would be very much appreciated.
Jon (A newcomer to C#).

--
Message posted via http://www.dotnetmonster.com

Nov 17 '05 #4
Hi Bob, Thanks for your advice too.

This is to both you and Dmitry. Is a class library the normal place where
all the application core classes are stored, and not to be stored in the
form or console files themselves?

Thanks very much, Jon.

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #5
A console application isn't a good place to try and keep utility classes. A
DLL is ideal and in fact is designed for just that case. Your class library
DLL can be accessed and shared by several applications at once. For
application core classes you might take an architectural descision to
maintain them in the application if the app wwas stand-alone but if you have
several "front-ends" for a suite of applications sharing common
functionality then you'd definitely keep it in a DLL.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jon via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in message
news:09******************************@DotNetMonste r.com...
Hi Bob, Thanks for your advice too.

This is to both you and Dmitry. Is a class library the normal place where
all the application core classes are stored, and not to be stored in the
form or console files themselves?

Thanks very much, Jon.

--
Message posted via http://www.dotnetmonster.com

Nov 17 '05 #6
Bob, Thanks alot. Created one last night. Jon.

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #7
"Jon via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> a écrit dans le
message de news: 4c******************************@DotNetMonster.com...
Secondly, in a window project's Button_Click event how do I create an
object of a class that is stored in the console project? - How do I fully
qualify it? - i.e. ConsoleName.NamespaceName.ClassName temp = new
ConsoleName.NamespaceName.ClassName();


If you are only using the console project to create classes for use in other
UI projects then you need to change this to a class library rather than an
executable project.

Once you have doen this, then simply add the library project to the
references of the UI projects and to the 'using' statements of the modules
that need the classes. Then you don't need to fully qualify the classes when
you use them.

Joanna

--
Joanna Carter
Consultant Software Engineer
Nov 17 '05 #8

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

Similar topics

2
by: Mark | last post by:
Is there a realistic way for some developers on our team to work with multiple projects in a single solution under VSS source control, and have other developers only working with a single project...
2
by: Ed_P. | last post by:
Hello, Up to this point, I've been using C# to create simple applications that only use on Project to store Windows Forms and other Files. The project has been complied into an EXE. The exe file...
2
by: TaeHo Yoo | last post by:
Hi all, I have a solution which contains multiple projects. Those multiple projects should share the same session. For example, users login, create the session for users then these session...
1
by: David L?pez | last post by:
Hi, I'm designing a new website and I'm starting to think about code organization. Until now I've worked in projects that had one solution and one project for the whole website. The question is...
3
by: Galore | last post by:
Hello! I'm trying to setup an ASP.NET multiple web projects application, following the article How To Create an ASP.NET Application from Multiple Projects for Team Development. I could do it...
0
by: Andy G | last post by:
I'm reading contradicting statements from Microsoft. This is very confusing and I am having a hell of a time with running multiple projects within one solution. From: Team Development with...
2
by: Samuel L Matzen | last post by:
Hi, I am trying to develop with multiple projects in a single solution. The many of these projects create .dlls that are used by other projects. When I reference a .dll I reference it in the...
1
by: David Herbst | last post by:
I have a solution that contains one main web project, ten sub web projects and a controls library project all in a single web application. I followed the steps in the following MS KB: How To...
6
by: thomson | last post by:
Hi All, i do hae a solution in which i do have mulitple projects including Web Projects,, Depending on the functionality it gets redirected to different web projects and it is working fine, ...
9
by: GaryDean | last post by:
I know this is a vs issue but nobody seems to answer posts over there... In VS 2008 I can't seem to get a multiple project solution. If I create a blank solution and add a project to it, it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.