On Wed, 12 Oct 2005 14:51:16 +0800, "Jason Huang"
<Ja************@hotmail.com> wrote in
<um**************@TK2MSFTNGP15.phx.gbl>:
In my ASP.Net 1.1, C#, I have two windows forms, one is frmContactPerson,
another is frmContactAddress.
These two forms has many same Controls, except in one GroupBox they have
different TextBoxes showing different data from datatable ContactPerson and
ContactAddress respectively.
Now come my question: How am I gonna apply the "Inheritance" concept in
that situation?
1. Create a form frmContactBase that contains all of the common
controls and code. If you have any controls or code that need to be
accessed by the derived forms, make them protected instead of private.
2. Remove the common controls and code from frmContactAddress and
frmContactPerson.
3. Modify frmContactAddress and frmContactPerson to inherit from
frmContactBase instead of System.Windows.Forms.Form.
One thing to be wary of is that the form designer has some odd
interactions with data-bound controls, datasets, etc. If you need to
populate anything in your Load event handler or constructor, put it
inside an if statement like this:
if (false == this.DesignMode)
{
// Load data
}
--
Charles Calvert | Software Design/Development
Celtic Wolf, Inc. | Project Management
http://www.celticwolf.com/ | Technical Writing
(703) 580-0210 | Research