GrapeCity MultiRow Windows Forms Documentation
DateTimePickerCell Class
Members  Example 


Represents a Cell that allows the user to select a date and a time and displays the date and time with a specified format.
Object Model
DateTimePickerCell ClassGcMultiRow ClassCellStyle ClassCellNote ClassSection ClassCellStyle ClassMultiRowTouchToolBar ClassValidatorCollection ClassCellValidator Class
Syntax
<ToolboxItemFilterAttribute(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom Or  _
    ToolboxItemFilterType.Prevent Or  _
    ToolboxItemFilterType.Require)>
<DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.DataFieldAndValidatorCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<ToolboxBitmapAttribute()>
<SRDescriptionAttribute("Enables the user to select a date or time, and display the date or time in the specified format.")>
Public Class DateTimePickerCell 
   Inherits Cell
Dim instance As DateTimePickerCell
[ToolboxItemFilter(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom | 
    ToolboxItemFilterType.Prevent | 
    ToolboxItemFilterType.Require)]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.DataFieldAndValidatorCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[ToolboxBitmap()]
[SRDescription("Enables the user to select a date or time, and display the date or time in the specified format.")]
public class DateTimePickerCell : Cell 
Remarks

The DateTimePickerCell class is a special type of Cell used to display a date time picker control, which is an editing field for date and time. The currently selected DateTimePickerCell hosts a DateTimePickerEditingControl in which the user can edit the cell's value.

If the cell's value is a null reference (Nothing in Visual Basic), the DateTimePickerCell shows DateTime.Now when it enters edit mode.

Notes to Inheritors:

When you derive from DateTimePickerCell 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.

Example
The following code example shows how to use a date time picker cell to edit dates or time and how to customize the properties of this cell.
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;

namespace GrapeCity.Win.MultiRow.SampleCode
{
    public class DateTimePickerCellDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();

        public DateTimePickerCellDemo()
        {
            this.Text = "DateTimePicker Demo";
            this.Size = new Size(550, 300);

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcMultiRow1);

            this.Load += new EventHandler(Form1_Load);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // create a template with 4 DateTimePicker box cell columns.
            DateTimePickerCell commonDateTimePickerCell = this.CreateCommonDateTimePickerCell();

            DateTimePickerCell showTimeDateTimePickerCell = this.CreateShowTimeDateTimePickerCell();

            DateTimePickerCell customAppearanceDateTimePickerCell = this.CreateCustomCalendarStyleAndFormat();

            DateTimePickerCell hiddenDropDownButtonDateTimePickerCell = this.CreateDateTimePickerCellHiddenDropDownButton();

            Cell[] DateTimePickerCells = new Cell[] { commonDateTimePickerCell, showTimeDateTimePickerCell, customAppearanceDateTimePickerCell, hiddenDropDownButtonDateTimePickerCell };

            this.gcMultiRow1.Template = Template.CreateGridTemplate(DateTimePickerCells);

            this.gcMultiRow1.ColumnHeaders[0][0].Value = "Show Date";
            this.gcMultiRow1.ColumnHeaders[0][1].Value = "Show Time";
            this.gcMultiRow1.ColumnHeaders[0][2].Value = "Custom Appearance";
            this.gcMultiRow1.ColumnHeaders[0][3].Value = "Hide Button";

            this.gcMultiRow1.RowCount = 6;
        }
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Data
Imports GrapeCity.Win.MultiRow

Public Class DateTimePickerCellDemo
    Inherits Form
    Private gcMultiRow1 As New GcMultiRow()

    Public Sub New()
        Me.Text = "DateTimePicker Demo"
        Me.Size = New Size(550, 300)

        ' Add MultiRow to form
        Me.gcMultiRow1.Dock = DockStyle.Fill
        Me.Controls.Add(Me.gcMultiRow1)
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        ' create a template with 4 DateTimePicker box cell columns.
        Dim commonDateTimePickerCell As DateTimePickerCell = Me.CreateCommonDateTimePickerCell()

        Dim showTimeDateTimePickerCell As DateTimePickerCell = Me.CreateShowTimeDateTimePickerCell()

        Dim customAppearanceDateTimePickerCell As DateTimePickerCell = Me.CreateCustomCalendarStyleAndFormat()

        Dim hiddenDropDownButtonDateTimePickerCell As DateTimePickerCell = Me.CreateDateTimePickerCellHiddenDropDownButton()

        Dim DateTimePickerCells As Cell() = New Cell() {commonDateTimePickerCell, showTimeDateTimePickerCell, customAppearanceDateTimePickerCell, hiddenDropDownButtonDateTimePickerCell}

        Me.gcMultiRow1.Template = Template.CreateGridTemplate(DateTimePickerCells)

        Me.gcMultiRow1.ColumnHeaders(0)(0).Value = "Show Date"
        Me.gcMultiRow1.ColumnHeaders(0)(1).Value = "Show Time"
        Me.gcMultiRow1.ColumnHeaders(0)(2).Value = "Custom Appearance"
        Me.gcMultiRow1.ColumnHeaders(0)(3).Value = "Hide Button"

        Me.gcMultiRow1.RowCount = 6
    End Sub
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         GrapeCity.Win.MultiRow.Cell
            GrapeCity.Win.MultiRow.DateTimePickerCell

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DateTimePickerCell Members
GrapeCity.Win.MultiRow Namespace
DateTimePickerEditingControl Class
Cell Class

 

 


Copyright © GrapeCity, inc. All rights reserved.