All pastes #618492 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-07-14 00:05 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace GridTest
{
    public class DataGridViewCustomColumn : DataGridViewColumn
    {
        public DataGridViewCustomColumn()
            : base(new DataGridViewCustomCell())
        {
        }
        public override DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }
            set
            {
                // Ensure that the cell used for the template is a CalendarCell.
                if (value != null &&
                    !value.GetType().IsAssignableFrom(typeof(DataGridViewCustomCell)))
                {
                    throw new InvalidCastException("Must be a Custom ComboBox Cell!");
                }
                base.CellTemplate = value;
            }
        }

    }
}