DataGridView - Date only format

1
0

I have a bound datagridview with one of the properties in the bound list as PODate (nullable datetime).

In the DataGridView, it shows as “Tuesday, June 1, 2017”.

How do I get it to show as “6/1/2017”?

I have tried using the Format=Custom along with CustomFormat dd/MM/yyyy

I also tried changing the DefaultCellStyle.Format to “d”

Neither seems to work.

Thanks,

Shawn

  • You must to post comments
0
0

Hi Shawn,

Have you tried the following?

var CellStyle = new DataGridViewCellStyle();
CellStyle.Format = “dd/MM/yyyy”;
myDateColumn.DefaultCellStyle = CellStyle;

Best,
Alex

  • You must to post comments
0
0

Thank you, that worked.

Does this functionality not work thought the DGV designer UI in Visual Studio?

  • Carl Daniel
    It appears that the designer drops the cell style on the floor for DateTimePicker columns – it’s missing from the .designer.cs file.
  • Frank (ITG)
    Hi Carl, thanks for your hint. We could reproduce and logged as WJ-8596. A fix will be included in the next Wisej build. Best regards, Frank
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.