It seems that the DateGridView1 is possible to change format of the date in specific column and I am using XtraGridView from DevExpress, May I ask that is it possible to change the date format in specific column in XtraGridView, I already coded but it won't work for me.
This is my code
Private Sub GridViewOBTA_ColumnChanged(sender As Object, e As EventArgs) Handles GridViewOBTA.ColumnChanged
GridViewOBTA.Columns(4).DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime
GridViewOBTA.Columns(4).DisplayFormat.FormatString = "d"
End Sub
I want to display the months and years only in GridViewOBTA. The date is in the 5th column. I put Column(4) because it started in 0, if I'm not mistaken. And I put formatString = "d" for the short date.
Thank you for answering this question.
Sincerely, Mr. Dev
The below works for me
GridViewOBTA.Columns("columname").DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime
GridViewOBTA.Columns("columname").DisplayFormat.FormatString = "dd/MM/yyyy HH:mm:ss"
You can change "dd/MM/yyyy HH:mm:ss" to "MM/yyyy" for months and year only.
Also i use this code when i fill the gridview and not within an event.(This is the issue in your case i think)