diff --git a/GUIs.Common/GridBuilder.vb b/GUIs.Common/GridBuilder.vb
index 4a817998..c70665d8 100644
--- a/GUIs.Common/GridBuilder.vb
+++ b/GUIs.Common/GridBuilder.vb
@@ -1,5 +1,8 @@
Imports System.Drawing
+Imports System.Globalization
Imports System.Windows.Forms
+Imports DevExpress.Utils
+Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraTreeList
@@ -64,6 +67,26 @@ Public Class GridBuilder
Next
End Sub
+ '''
+ ''' Applies a proper datetime format string to all columns of the view.
+ '''
+ ''' The view's columns need to be loaded for this to work!
+ Public Sub SetDateTimeColumns(pView As GridView)
+ If pView.Columns Is Nothing Then
+ Exit Sub
+ End If
+
+ Dim oDateColumns = pView.Columns.AsEnumerable.
+ Where(Function(column As GridColumn) column.ColumnType = GetType(Date)).
+ ToList()
+
+ For Each oDateCol In oDateColumns
+ oDateCol.DisplayFormat.FormatType = FormatType.Custom
+ oDateCol.DisplayFormat.FormatString = "g"
+ oDateCol.DisplayFormat.Format = DateTimeFormatInfo.CurrentInfo
+ Next
+ End Sub
+
'''
''' Applies common properties to all GridViews
'''
@@ -198,4 +221,5 @@ Public Class GridBuilder
e.Handled = True
End If
End Sub
+
End Class