DataGridView - Date only format

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
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

Thank you, that worked.

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

  • 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
Showing 2 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 1, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json