GrapeCity MultiRow Windows Forms Documentation
Get Formatted Values (DateTimePickerCell)

The date time picker cell does not support the DateTimePickerCell.Style.Format property, so the DateTimePickerCell.FormattedValue property always returns the string value of the DateTimePickerCell.Value property regardless of the values of the DateTimePickerCell.Format property or the DateTimePickerCell.CustomFormat property (for example: 9998/12/31 00:00:00).

You can use the Cell.DisplayText property or the GcMultiRow.GetDisplayText method to get the formatted values of the date time picker cell.

Using Code

This example gets the cell values.

[VB]

Imports GrapeCity.Win.MultiRow

Dim dateTimePickerCell1 As New DateTimePickerCell()
dateTimePickerCell1.Format = DateTimePickerFormat.Short
dateTimePickerCell1.Value = DateTime.Now

Dim template1 As Template = Template.CreateGridTemplate(New Cell() {dateTimePickerCell1})
GcMultiRow1.Template = template1
GcMultiRow1.CurrentCellPosition = New CellPosition(0, 0)

Console.WriteLine("Formatted Value 1: {0}", GcMultiRow1.GetDisplayText(GcMultiRow1.CurrentCellPosition.RowIndex, GcMultiRow1.CurrentCellPosition.CellIndex))
Console.WriteLine("Formatted Value 2: {0}", GcMultiRow1.CurrentCell.DisplayText)
Console.WriteLine("Cell Value: {0}", GcMultiRow1.CurrentCell.FormattedValue.ToString())

[CS]

using GrapeCity.Win.MultiRow;

DateTimePickerCell dateTimePickerCell1 = new DateTimePickerCell();
dateTimePickerCell1.Format = DateTimePickerFormat.Short;
dateTimePickerCell1.Value = DateTime.Now;

Template template1 = Template.CreateGridTemplate(new Cell[] { dateTimePickerCell1 });
gcMultiRow1.Template = template1;
gcMultiRow1.CurrentCellPosition = new CellPosition(0, 0);

Console.WriteLine("Formatted Value 1: {0}", gcMultiRow1.GetDisplayText(gcMultiRow1.CurrentCellPosition.RowIndex, gcMultiRow1.CurrentCellPosition.CellIndex));
Console.WriteLine("Formatted Value 2: {0}", gcMultiRow1.CurrentCell.DisplayText);
Console.WriteLine("Cell Value: {0}", gcMultiRow1.CurrentCell.FormattedValue.ToString());
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options