PC Review


Reply
Thread Tools Rate Thread

How to design a large .NET Project - Reuse Components

 
 
aaapaul
Guest
Posts: n/a
 
      18th Oct 2007
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

 
Reply With Quote
 
 
 
 
Jeff Gaines
Guest
Posts: n/a
 
      18th Oct 2007
On 18/10/2007 in message
<(E-Mail Removed)> 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
 
Reply With Quote
 
aaapaul
Guest
Posts: n/a
 
      18th Oct 2007
Thanks Jeff, but I donīt 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īt this possible in .NET any more?

Outer solutions?

Thanks

 
Reply With Quote
 
PvdG42
Guest
Posts: n/a
 
      18th Oct 2007
"aaapaul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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 <formname>.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.

 
Reply With Quote
 
aaapaul
Guest
Posts: n/a
 
      18th Oct 2007
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.

 
Reply With Quote
 
sloan
Guest
Posts: n/a
 
      18th Oct 2007

If you're serious about it, then I'd recommend
http://www.amazon.com/Developing-App...ion/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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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


 
Reply With Quote
 
PvdG42
Guest
Posts: n/a
 
      18th Oct 2007
"aaapaul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?

 
Reply With Quote
 
aaapaul
Guest
Posts: n/a
 
      19th Oct 2007
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.

 
Reply With Quote
 
Sujith S.Varier
Guest
Posts: n/a
 
      19th Oct 2007

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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> If you're serious about it, then I'd recommend
> http://www.amazon.com/Developing-App...ion/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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
aaapaul
Guest
Posts: n/a
 
      19th Oct 2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reuse business methods as DLL in another project?? ashrafnairoukh@yahoo.com Microsoft Dot NET Framework 2 24th Jul 2006 01:03 AM
reuse business methods as DLL in another project ??? ashrafnairoukh@yahoo.com Microsoft Dot NET 0 22nd Jul 2006 05:28 PM
project with serviced components and non services components z f Microsoft ADO .NET 4 6th Oct 2005 02:14 PM
Reuse a table design Martin Microsoft Access Database Table Design 0 16th Sep 2004 03:36 PM
Reuse a table design =?Utf-8?B?Q29va2ll?= Microsoft Access Database Table Design 0 16th Sep 2004 02:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:42 PM.