473,387 Members | 1,705 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,387 software developers and data experts.

Why not both?

One of the main reasons for using inheritance is so you
don't have to reinvent the wheel with every app you
write. UserControls exist for you to inherit from so you
don't have to write all the plumbing code yourself, such
as notifying child controls when they should be
repainted.

Are there events fired in your custom collection when
controls are added and deleted? If so, you can use these
to update the Controls collection of the user control
whenever anything changes.

CollectionProperty.ControlAdded += new EventHandler
(ControlAdded);

void ControlAdded(object sender, EventArgs e){
this.Controls.Add(sender);
}

You don't need to use events, of course, but it would
make it easier to keep track of changes. Otherwise, just
remember to make changes to both collections whenever you
change one.

Charlie
Nov 15 '05 #1
4 946
> One of the main reasons for using inheritance is so you don't have to
reinvent the wheel with every app > you write.

Isn't that a little bit of an exaggeration? I have been writing
applications for more years than I would like to admit, only tried OO
recently and hardly used inheritance yet, but I certainly did not re-invent
the wheel with each app I wrote, and I have - like many other people -
developed a library of common functions with lasting interfaces.

Peter Seaman
Nov 15 '05 #2
I say use all three, just to be sure.
"Peter Seaman" <Peter MS Seaman at StableSoftware.com> wrote in message
news:uk*************@tk2msftngp13.phx.gbl...
One of the main reasons for using inheritance is so you don't have to reinvent the wheel with every app > you write.

Isn't that a little bit of an exaggeration? I have been writing
applications for more years than I would like to admit, only tried OO
recently and hardly used inheritance yet, but I certainly did not

re-invent the wheel with each app I wrote, and I have - like many other people -
developed a library of common functions with lasting interfaces.

Peter Seaman

Nov 15 '05 #3
Obviously, my post was supposed to a response but I
clicked the wrong button, it seems :)

I certainly did not mean to suggest that inheritance is
the only way to reuse code. The poster's question was
why the child controls in his custom control were not
being repainted when he thought they should be. The
reinvention part I was speaking of was the built-in
plumbing that container controls have to notify child
controls of such events. There's no need to write it
himself if it's already there for him to use.

Charlie
-----Original Message-----
One of the main reasons for using inheritance is so
you don't have toreinvent the wheel with every app > you write.

Isn't that a little bit of an exaggeration? I have been writingapplications for more years than I would like to admit, only tried OOrecently and hardly used inheritance yet, but I certainly did not re-inventthe wheel with each app I wrote, and I have - like many other people -developed a library of common functions with lasting interfaces.
Peter Seaman
.

Nov 15 '05 #4
I have reconsidered my original position and will now
settle for no less than four
-----Original Message-----
I say use all three, just to be sure.
"Peter Seaman" <Peter MS Seaman at StableSoftware.com> wrote in messagenews:uk*************@tk2msftngp13.phx.gbl...
> One of the main reasons for using inheritance is so
you don't have to reinvent the wheel with every app > you write.

Isn't that a little bit of an exaggeration? I have been writing applications for more years than I would like to admit, only tried OO recently and hardly used inheritance yet, but I certainly did not
re-invent
the wheel with each app I wrote, and I have - like

many other people - developed a library of common functions with lasting interfaces.
Peter Seaman

.

Nov 15 '05 #5

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

Similar topics

1
by: Cindy | last post by:
On Thu, 3 Jul 2003 17:23:22 +0800, "Cindy" <stayhardsg@yahoo.com.sg> wrote: >Would appreciate if someone could point me to a website to find a javascript >that could perform the following: >...
2
by: maddog | last post by:
My works are done in vs.net. I wanna take a look at vs.net2003. any suggestion are welcome. thanks. -- maddog
2
by: faktujaa | last post by:
Hi, I have created an application that uses IIS to host remote components. All the remote components are listed in app.config in client and web.config in server. Now the app.config can contain...
1
by: Bob N5 | last post by:
I am working on an application that uses interop to do some simple operations with both Excel and Word. I have most of functionality working, but ran into issues on making things work with both...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
102
by: BoogieWithStu22 | last post by:
I am running into a problem with a web page I have created when viewing it in IE6 on some machines. The page has a database lookup. The user enters an account name or number and clicks a lookup...
4
by: Jim Carlock | last post by:
I'm working with three column layouts without tables. The page in question... http://www.microcosmotalk.com/images/garden/vine.asp Using clear:both; causes problems in the left and right...
14
by: Monty | last post by:
Hello, I have created a solution which has both a web UI and a winform UI, the latter is just for administrators. The Web UI (a Web Application Project) and the winform project both...
2
by: rjmckay | last post by:
At work (with restricted permissions) ... I share a desk with another person. I have a USB hub that both of us hook our headphones up to. The problem is, that sound doesn't go to both...
8
by: tshad | last post by:
I have a VS 2008 project that is going to create a Class Library. Can I use both C# and VB files to create this? I have 3 classes that are in C# and 4 that are in VB and would like to put them...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.