C#.net custom control

M

midnight

I and another girl developer at worI want to to know how to do the following
in a C#.NET 3.5 non-web application:
1. I have a delgate in one project and I want to have the delegate be
executed from a click event in another project. How do I setup this type of a
project refernce?
(Note: This is existing code that is not working. Some other programmer
wrote it.)
2. I have setup a control that I want to share with several projects within
one solution and a copy of different solutions. Thus can you tell me:
a. How to compile(build) the custom contol to generate a DLL?
b. Once I have the DLL, where do I place in the folders so that various
projects can access it?
C. What do I do in the .net to solution to add it (be connected) to other
parts of the solution? What should I do to include the custom control in
other C#.net solutions?
 
M

Mr. Arnold

midnight said:
I and another girl developer at worI want to to know how to do the following
in a C#.NET 3.5 non-web application:
1. I have a delgate in one project and I want to have the delegate be
executed from a click event in another project. How do I setup this type of a
project refernce?

By using .Net Remoting over TCP/IP or WCF client/service over TCP, Named
Piped or MSMQ and sending a message to the other project to a service in
the other project that is listening.

In either case Remoting or WCF, one project is the client and the other
project is the service.

Those are two ways you can communicate between projects in the same
solution.
(Note: This is existing code that is not working. Some other programmer
wrote it.)
2. I have setup a control that I want to share with several projects within
one solution and a copy of different solutions. Thus can you tell me:
a. How to compile(build) the custom contol to generate a DLL?

The control would be placed in a classlib project, which is compiled
into a DLL.
b. Once I have the DLL, where do I place in the folders so that various
projects can access it?

The DLL should be placed in the Bin directory where the exe is located.
C. What do I do in the .net to solution to add it (be connected) to other
parts of the solution? What should I do to include the custom control in
other C#.net solutions?

Put the DLL in the Bin directory and set reference to it.

But the better option would be to share the project across solutions by
it being a project in a given solution and projects that need the
project setting 'Project Reference' to the project in the solution. The
DLL is placed in the correct spot and all other projects can see it,
when using 'Project Reference'.

The sharing of the project by other solutions would be accomplished by
using a code repoitory like Team Foundation Server or other such code
repositories.
 
M

midnight

1. When looking at a large solution (lots of projects), how can you tell
where the custom control code is located at?
The custom control will be in whatever executable corresponds to the
project in which the code is contained. It can be in its own standalone
project, or part of some other project, where the project may be in its
own solution or part of a larger one.
2 How can delegate(s) be accessed by code when the reference to a delegate
are in different projects? (How to you set this up in the .net solution?) How
do you know if the delegates are in the same project or different project?
By the way, there is absolutely no need to use any kind of remoting,
networking, message passing, etc. As long as the types are visible in
the same project (which that itself _is_ related to the project
references), passing the delegate object is as simple as just passing
the reference to a method, subscribing to an event, etc.
3. I want to make certain that all projects within a soltuion can access
each other when needed? Basically I want dll's to be accessed when needed
between projects.
I want all delegates between projects to be accessible. How can you tell if
this is setup correctly?
 
M

midnight

Here are some more questions:

1. How can you tell if .Net Remoting over TCP/IP or WCF client/service over
TCP, Named Piped or MSMQ is being used? Which method is better?
By using .Net Remoting over TCP/IP or WCF client/service over TCP, Named
Piped or MSMQ and sending a message to the other project to a service in
the other project that is listening.

In either case Remoting or WCF, one project is the client and the other
project is the service.

2. The other person that responded to this e-mail message said the following:
"By the way, there is absolutely no need to use any kind of remoting,
networking, message passing, etc. As long as the types are visible in
the same project (which that itself _is_ related to the project
references), passing the delegate object is as simple as just passing
the reference to a method, subscribing to an event, etc. ".

Thus can you tell me if your way and/or his way are good methods for having
different projects communicate with each other in the same solution?
 
M

Mr. Arnold

midnight said:
Here are some more questions:

1. How can you tell if .Net Remoting over TCP/IP or WCF client/service over
TCP, Named Piped or MSMQ is being used? Which method is better?

..Net Remoting is a legacy solution that is being replaced by WCF.

What is WCF?

Windows Communication Foundation (WCF) is a framework for building
service-oriented applications. Using WCF, you can send data as
asynchronous messages from one service endpoint to another.
A service endpoint can be part of a continuously available service
hosted by IIS,or it can be a service hosted in an application.
An endpoint can be a client of a service that requests data from a
service endpoint. The messages can be as simple as a single character or
word sent as XML, or as complex as a stream of binary data. A few sample
scenarios include:

http://msdn.microsoft.com/en-us/library/ms731082.aspx
2. The other person that responded to this e-mail message said the following:
"By the way, there is absolutely no need to use any kind of remoting,
networking, message passing, etc. As long as the types are visible in
the same project (which that itself _is_ related to the project
references), passing the delegate object is as simple as just passing
the reference to a method, subscribing to an event, etc. ".

It may be ok and could be the correct method in your situation.

However for you, it would be contingent upon everything happening in the
same project and if not, you may have to explore another approach.

I have not worked in the Windows desktop environment in many years. The
method wouldn't work if projects (dll's) were on physical n-tier
boundaries.
Thus can you tell me if your way and/or his way are good methods for having
different projects communicate with each other in the same solution?

It depends upon the circumstances if all the solution components are
deployed to a single machine or deployed/distributed across multiple
machines.

If it's all on the same machine, then go with the other poster. But be
aware that WCF is there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top