I am populating a DataSet using SqlAdapter and then displaying it in a DataGrid. Some of the values in the DataSet are DateTime. It seems by default they are displaying as dd/mm/yyyy and I want to also display the time. I have played around with the DataGridTableStyle and the DataGridTextBoxColumn but nothing seems to take affect. Is there a good resource that outlines how to use these classes or is their an easier way to go about things?



--
Dan S

Re: DateTime values in DataGrid by Tim

Tim
Tue Jul 13 14:49:45 CDT 2004

One way to do this is to create a custom DataGridColumnStyle that utilizes
the DateTimePicker. See the example in the MSDN docs.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsdatagridcolumnstyleclasstopic.asp

This might also be helpful.
http://www.i-syn.gmxhome.de/devcom/colstyles/intro.htm

--
Tim Wilson
.Net Compact Framework MVP

"Dan S" <DanS@discussions.microsoft.com> wrote in message
news:BC092533-3CA9-48FF-AFB0-0530A00F2317@microsoft.com...
> I am populating a DataSet using SqlAdapter and then displaying it in a
DataGrid. Some of the values in the DataSet are DateTime. It seems by
default they are displaying as dd/mm/yyyy and I want to also display the
time. I have played around with the DataGridTableStyle and the
DataGridTextBoxColumn but nothing seems to take affect. Is there a good
resource that outlines how to use these classes or is their an easier way to
go about things?
>
>
>
> --
> Dan S



Re: DateTime values in DataGrid by Claes

Claes
Wed Jul 14 03:10:31 CDT 2004

Set the Format property of the corresponding
DataGridTextBoxColumn to the format you want (e.g. "g").
See the docs for the DateTimeFormatInfo class for
valid values.

Note that the DataType property of the underlying
DataColumn must be set to the DateTime type (but
is sounds like it already is)

/claes

"Dan S" <DanS@discussions.microsoft.com> wrote in message
news:BC092533-3CA9-48FF-AFB0-0530A00F2317@microsoft.com...
> I am populating a DataSet using SqlAdapter and then displaying it in a
DataGrid. Some of the values in the DataSet are DateTime. It seems by
default they are displaying as dd/mm/yyyy and I want to also display the
time. I have played around with the DataGridTableStyle and the
DataGridTextBoxColumn but nothing seems to take affect. Is there a good
resource that outlines how to use these classes or is their an easier way to
go about things?
>
>
>
> --
> Dan S