APG.CodeHelper.DataGridViewHelper.EnterDateTimeCell C# (CSharp) Method

EnterDateTimeCell() public static method

public static EnterDateTimeCell ( System.Windows.Forms.DataGridView dataGridView, System.Windows.Forms.DataGridViewCellEventArgs e, DateTimePickerFormat dateTimePickerFormat ) : void
dataGridView System.Windows.Forms.DataGridView
e System.Windows.Forms.DataGridViewCellEventArgs
dateTimePickerFormat DateTimePickerFormat
return void
        public static void EnterDateTimeCell(DataGridView dataGridView, DataGridViewCellEventArgs e, DateTimePickerFormat dateTimePickerFormat)
        {
            if (dataGridView.Columns[e.ColumnIndex].ValueType == typeof(DateTime))
            {
                CreateDateTimePicker();

                currentDataGridView = dataGridView;
                dtpEventDatePicker.Tag = e;

                //dtpEventDatePicker.TextChanged += new EventHandler(dtpEventDatePicker_TextChanged);

                if (dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value is DateTime)
                    dtpEventDatePicker.Value = (DateTime)dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                else
                    dtpEventDatePicker.Value = DateTime.Today;

                dtpEventDatePicker.Format = dateTimePickerFormat;

                if (dtpEventDatePicker.Format == DateTimePickerFormat.Time)
                    dtpEventDatePicker.ShowUpDown = true;
                else
                    dtpEventDatePicker.ShowUpDown = false;

                dtpEventDatePicker.Parent = dataGridView;
                dtpEventDatePicker.Bounds = dataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);

                dtpEventDatePicker.Visible = !dataGridView.ReadOnly;

            }
        }

Same methods

DataGridViewHelper::EnterDateTimeCell ( System.Windows.Forms.DataGridView dataGridView, System.Windows.Forms.DataGridViewCellEventArgs e, string customFromat ) : void