How to design a large .NET Project - Reuse Components

How to design a large .NET Project - Reuse Components

am 18.10.2007 11:46:10 von aaapaul

We are planning a greater .NET Application-System (WindowsForms) with
Visual Studio 2005.

One of my problem is, how to design the objects, that they can be
reused.

Eg. I have a form (with derived textboxes) that should be used in
several Projects.

I tried to copy the form to the other project - with no success.
Adding as a linked component didn=B4t work, too.

Do I have to work with UserControls and dlls? How about updates.

Who has experience in such things.

Thanks for help
aaapaul

Re: How to design a large .NET Project - Reuse Components

am 18.10.2007 13:39:57 von Jeff Gaines

On 18/10/2007 in message
<1192700770.693728.11400@i38g2000prf.googlegroups.com> aaapaul wrote:

>I tried to copy the form to the other project - with no success.
>Adding as a linked component didn´t work, too.

Either of those approaches *should* work, linking is probably better since
you only have to modify/update the form once.

Is it the main form in each app? If so you should delete the 'Form1' that
VS automatically adds and set your form as the startup form.
--
Jeff Gaines

Re: How to design a large .NET Project - Reuse Components

am 18.10.2007 14:11:14 von aaapaul

Thanks Jeff, but I don=B4t understand your answer.

Let me give you more details.

In VB6 ist was possible to use the same form in several projects:

sample
c:\vb6\p1\
c:\vb6\p2\
c:\vb6\common

I had a frmUni in c:\vb6\common and I could use it in p1 and p2 - I
simple added it to the projects.

Isnt=B4t this possible in .NET any more?

Outer solutions?

Thanks

Re: How to design a large .NET Project - Reuse Components

am 18.10.2007 14:36:14 von pvdg42

"aaapaul" wrote in message
news:1192700770.693728.11400@i38g2000prf.googlegroups.com...
We are planning a greater .NET Application-System (WindowsForms) with
Visual Studio 2005.

One of my problem is, how to design the objects, that they can be
reused.

E.g. I have a form (with derived textboxes) that should be used in
several Projects.

I tried to copy the form to the other project - with no success.
Adding as a linked component didn´t work, too.

Do I have to work with UserControls and dlls? How about updates.

Who has experience in such things.

Thanks for help
aaapaul


Are the forms to be reused in projects within the same solution, or are they
in different solutions?
If the projects are in a common solution copying is simple and
semi-automatic (select the .vb to copy and the support files are
automatically copied as well), and adding a link to another project is also
straight forward (right-click on project in solution explorer->Add
reference...).
If you have separate solutions that's a different matter.

Re: How to design a large .NET Project - Reuse Components

am 18.10.2007 14:56:26 von aaapaul

Thanks.

The problem appears only when I am using a derived control on the box.

I have a solution with
project 1
and
project 2

In project1 there is a form1 that I want to use in project2

So I added in project2 a reference to form1 from project1.

This works.

But when I place a derived textbox (ltext1) on form1.

The error "project1.ltext1 is not defined" appears.

Any idea?

Thanks.

Re: How to design a large .NET Project - Reuse Components

am 18.10.2007 16:43:18 von sloan

If you're serious about it, then I'd recommend
http://www.amazon.com/Developing-Application-Frameworks-NET- Chen/dp/product-description/1590592883

He gives you a good understanding of what you're actually doing and provides
some code.
Most is germane to 1.1, but the concepts apply to whatever version/language
you use.


Read the reviews on the amazon site.





"aaapaul" wrote in message
news:1192700770.693728.11400@i38g2000prf.googlegroups.com...
We are planning a greater .NET Application-System (WindowsForms) with
Visual Studio 2005.

One of my problem is, how to design the objects, that they can be
reused.

E.g. I have a form (with derived textboxes) that should be used in
several Projects.

I tried to copy the form to the other project - with no success.
Adding as a linked component didn´t work, too.

Do I have to work with UserControls and dlls? How about updates.

Who has experience in such things.

Thanks for help
aaapaul

Re: How to design a large .NET Project - Reuse Components

am 18.10.2007 16:58:57 von pvdg42

"aaapaul" wrote in message
news:1192712186.968011.120250@y27g2000pre.googlegroups.com.. .
> Thanks.
>
> The problem appears only when I am using a derived control on the box.
>
> I have a solution with
> project 1
> and
> project 2
>
> In project1 there is a form1 that I want to use in project2
>
> So I added in project2 a reference to form1 from project1.
>
> This works.
>
> But when I place a derived textbox (ltext1) on form1.
>
> The error "project1.ltext1 is not defined" appears.
>
> Any idea?
>
> Thanks.
>

Where, exactly, is your subclass of TextBox? In project1, perhaps?
What happens if you add a reference to your subclass to project 2?

Re: How to design a large .NET Project - Reuse Components

am 19.10.2007 08:08:47 von aaapaul

The Subclass of the Textbox is in Project1 as a reference of Project3
(ltext.vb).

I added the Reference (ltext.vb) to Project2 too, with no success.

Error in Project2: Project1.LText is not defined.

Thanks.

Re: How to design a large .NET Project - Reuse Components

am 19.10.2007 09:01:46 von sujit.svarier

See, if you are using the same form in two different projects this may work
- take project2
- add a reference to project1
- add a class in project2 that inherits from project1.form1

this will make the reuse of the entire code you have in project1.form1
possible

regards
Sujith



"sloan" wrote in message
news:OIJG6UZEIHA.536@TK2MSFTNGP06.phx.gbl...
>
> If you're serious about it, then I'd recommend
> http://www.amazon.com/Developing-Application-Frameworks-NET- Chen/dp/product-description/1590592883
>
> He gives you a good understanding of what you're actually doing and
> provides some code.
> Most is germane to 1.1, but the concepts apply to whatever
> version/language you use.
>
>
> Read the reviews on the amazon site.
>
>
>
>
>
> "aaapaul" wrote in message
> news:1192700770.693728.11400@i38g2000prf.googlegroups.com...
> We are planning a greater .NET Application-System (WindowsForms) with
> Visual Studio 2005.
>
> One of my problem is, how to design the objects, that they can be
> reused.
>
> E.g. I have a form (with derived textboxes) that should be used in
> several Projects.
>
> I tried to copy the form to the other project - with no success.
> Adding as a linked component didn´t work, too.
>
> Do I have to work with UserControls and dlls? How about updates.
>
> Who has experience in such things.
>
> Thanks for help
> aaapaul
>
>

Re: How to design a large .NET Project - Reuse Components

am 19.10.2007 14:24:11 von aaapaul

Thanks Sujith!

I did it like you described it.

I have now project1 and project2 in one solution.
I added in project2 a reference to application1 and I said

Dim x As New Project1.Form1()
x.ShowDialog()

This works.

But now I have 2 exe and cant start one exe without the other.

I only wanted to complie the form1 of Project1 in Project 2.

Its seems, thats this behavior is not so good like in VB6

Re: How to design a large .NET Project - Reuse Components

am 22.10.2007 01:13:24 von Andrew Faust

In reading some of your other posts it sounds like what you are trying to
do is reference the actual source files from multiple projects directly
within the other projects. The better method is to create multiple class
library projects (.dlls) and reference the dlls in the other projects. Any
classes (and a form is just a class) that needs to be used by your other
projects needs to be made public.

--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com


"aaapaul" wrote in message
news:1192700770.693728.11400@i38g2000prf.googlegroups.com...
We are planning a greater .NET Application-System (WindowsForms) with
Visual Studio 2005.

One of my problem is, how to design the objects, that they can be
reused.

E.g. I have a form (with derived textboxes) that should be used in
several Projects.

I tried to copy the form to the other project - with no success.
Adding as a linked component didn´t work, too.

Do I have to work with UserControls and dlls? How about updates.

Who has experience in such things.

Thanks for help
aaapaul

Re: How to design a large .NET Project - Reuse Components

am 22.10.2007 09:20:04 von Sujith S Varier

Okay,

I guess, you don't want to reuse the form1 in its compiled form. You just
want to add an existing form in "project1" to "project2". Is that so?
(Sorry, if i am wrong).
Adding an existing form in one project to another is possible as follows
Take solution explorer.
Select project, right mouse button, Select Add existing item, browse the
filesystem and select the form1 (which is residing at the project folder of
"Project1").
This when compiled creates only one executable, project2.exe.

Let me know whether this was the solution you were lookin for.

Regards
Sujith


"aaapaul" wrote in message
news:1192796651.150489.155640@e9g2000prf.googlegroups.com...
> Thanks Sujith!
>
> I did it like you described it.
>
> I have now project1 and project2 in one solution.
> I added in project2 a reference to application1 and I said
>
> Dim x As New Project1.Form1()
> x.ShowDialog()
>
> This works.
>
> But now I have 2 exe and cant start one exe without the other.
>
> I only wanted to complie the form1 of Project1 in Project 2.
>
> Its seems, thats this behavior is not so good like in VB6
>

Re: How to design a large .NET Project - Reuse Components

am 22.10.2007 09:39:27 von Sujith S Varier

"Project1.Ltext"!!!
that means LText when copied to Project2, lost its previous identity
"Project1.Ltext" and it gains the new one Project2.Ltext. I guess you are
working with Visual Basic. Is that so? Then modify the namespace so that
LText retains the same identity in both the projects.

Regards
Sujith



"aaapaul" wrote in message
news:1192774127.610618.85420@k35g2000prh.googlegroups.com...
> The Subclass of the Textbox is in Project1 as a reference of Project3
> (ltext.vb).
>
> I added the Reference (ltext.vb) to Project2 too, with no success.
>
> Error in Project2: Project1.LText is not defined.
>
> Thanks.
>

Re: How to design a large .NET Project - Reuse Components

am 23.10.2007 12:31:22 von aaapaul

Thanks Sujith !

I think this is the solution.

Changing the namespace is not good, because the namespace ist in the
other project wrong than.

But if I delete a part of the namespace.

project1.ltext -> simple ltext.

It works=B4in both projects.

Programming could be so simple ....

Thanks all
aaapaul