Hi,
I am using .NET Framework 1.1 and VS.NET 2003
I am pulling a recordset from an ORACLE database into a Windows Forms form
and displaying the data in a datagrid..
Trouble is, even though the data includes datetime fields, the datagrid
absolutely refuses to display them at runtime in proper datetime format (just
shows . I know the time information is there because I can export to csv and
the time is in each field.
I even got some code from Kelly in another thread to force datetime fields
to be formatted properly like this:
>>> CODE >>>
Public Shared Sub Format(ByRef grd As DataGrid, ByRef dt As DataTable)
Dim ts As New DataGridTableStyle()
Dim tc As DataGridTextBoxColumn
Dim dc As DataColumn
For Each dc In dt.Columns
tc = New DataGridTextBoxColumn()
tc.MappingName = dc.ColumnName
tc.HeaderText = tc.MappingName
If dc.DataType Is GetType(System.DateTime) Then
tc.Format = "MM/dd/yyyy hh:mm:ss"
tc.Width = 125
End If
ts.GridColumnStyles.Add(tc)
Next
grd.TableStyles.Clear()
grd.TableStyles.Add(ts)
grd.DataSource = Nothing
grd.DataSource = dt
<<< END CODE <<<
Now, when I run this, several fields are identified as system.datetime and
these get the special format.
But nothing happens in the datagrid.
Is there anything else I can do to show the time with the dates?
thanks for any help or assistance
Philip