How to save the property of the user-defined column ?
-
public class TXDataGridViewNumericColumn : DataGridViewColumn { public TXDataGridViewNumericColumn() : base(new TXNumericCell()) { this.InputType = NumericType.Integer; } public override DataGridViewCell CellTemplate { get { return base.CellTemplate; } set { if (value != null && !value.GetType().IsAssignableFrom(typeof(TXNumericCell))) { throw new InvalidCastException("Must be a CalendarCell"); } base.CellTemplate = value; } } private NumericType m_NumericType; public enum NumericType { Decimal, Integer, PositiveDecimal, NegativeDecimal, PositiveInteger, NegativeInteger } public NumericType InputType { get { return m_NumericType; } set { m_NumericType = value; } } public ICollection testCollection { get { return Icollection; } set { Icollection = value; } } private ICollection Icollection; public override object Clone() { DataGridViewColumn col = (DataGridViewColumn)base.Clone(); col.CellTemplate = new TXNumericCell(); return col; } } public class TXNumericCell : DataGridViewTextBoxCell { public TXNumericCell() : base() { } public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); TXNumericEditControl ctl = DataGridView.EditingControl as TXNumericEditControl ; ctl.Text = (string )this.Value; } public override Type EditType { get { return typeof(TXNumericEditControl); } } public override Type ValueType { get { return typeof(string); } } public override object DefaultNewRowValu
-
public class TXDataGridViewNumericColumn : DataGridViewColumn { public TXDataGridViewNumericColumn() : base(new TXNumericCell()) { this.InputType = NumericType.Integer; } public override DataGridViewCell CellTemplate { get { return base.CellTemplate; } set { if (value != null && !value.GetType().IsAssignableFrom(typeof(TXNumericCell))) { throw new InvalidCastException("Must be a CalendarCell"); } base.CellTemplate = value; } } private NumericType m_NumericType; public enum NumericType { Decimal, Integer, PositiveDecimal, NegativeDecimal, PositiveInteger, NegativeInteger } public NumericType InputType { get { return m_NumericType; } set { m_NumericType = value; } } public ICollection testCollection { get { return Icollection; } set { Icollection = value; } } private ICollection Icollection; public override object Clone() { DataGridViewColumn col = (DataGridViewColumn)base.Clone(); col.CellTemplate = new TXNumericCell(); return col; } } public class TXNumericCell : DataGridViewTextBoxCell { public TXNumericCell() : base() { } public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); TXNumericEditControl ctl = DataGridView.EditingControl as TXNumericEditControl ; ctl.Text = (string )this.Value; } public override Type EditType { get { return typeof(TXNumericEditControl); } } public override Type ValueType { get { return typeof(string); } } public override object DefaultNewRowValu
No one will read such a long post. Don't dump all your code. Please modify your post and put only the code that is relevant and wrap it inside
<pre></pre>
tags so that CP will format it. :)Navaneeth How to use google | Ask smart questions