Q:

DateTime Display in Windows Form application

I have a windows form application. I have a query which return me datetime in the format dd-MM-yyyy.
But when this datetime is displayed in a datagrid it is displayed as dd/MM/yyyy.
I wish to display dd-MM-yyyy in my datagrid. How can this be achieved.

A:

You set this in the column's DefaultCellStyle.Format:
this.dataGridView1.Columns["Date"].DefaultCellStyle.Format = "dd-MM-yyyy";

