FlexGrid for WinForms | ComponentOne
C1.Win.FlexGrid Namespace / Column Class / DataType Property

In This Topic
    DataType Property (Column)
    In This Topic
    Gets or sets the type of object stored in this row or column.
    Syntax
    'Declaration
     
    
    Public Overridable Property DataType As Type
    public virtual Type DataType {get; set;}
    Remarks

    By default, the column's DataType property is set to System.Object, which allows you to store any data values in the column.

    If you set a row or column's DataType to a specific type, the grid will try to convert any values assigned to cells in that column to the specified data type. If the conversion fails, the grid will fire a GridError event and the cell value will not be changed.

    The DataType property affects how values are stored internally in the grid, how they are sorted, and the type of control that is used to edit the values in the column. For example, a System.Windows.Forms.DateTimePicker control is used to edit values in System.DateTime columns, and check boxes are used to display and edit values in Boolean columns.

    If you want to store times (not dates) in a column, you can still use the DateTime type, but you should use a RowCol.Format that displays only the time, not the date.

    See Also