Hi there,
Consider this from MSDN
*Notes to Inheritors When you derive from DataGridViewCheckBoxCell and add
new properties to the derived class, be sure to override the Clone method to
copy the new properties during cloning operations. You should also call the
base class's Clone method so that the properties of the base class are copied
to the new cell. *
How should I do this?
a)
public override object Clone()
{
MemberwiseClone();
}
// this is no good jsut a shallow copy
b)
public override object Clone()
{
NumericDataGridViewTextBox tb = (NumericDataGridViewTextBox)base.Clone();
tb.MaxValue = this.MaxValue;
tb.MinValue = this.MinValue;
return tb;
}
// This seems to work; but is it? I.e. the base.Clone is only returning a
base object so surely when i cast to a derived object and start writing my
max min integers i over write some of the base somehow?
....tnx in advance, brian