Formating DateTime Cells on Datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

I have a datagrid that have a DateTime Column, that I built with this code:

DataGridTextBoxColumn ExcColumn;
ExcColumn= dgExc.TableStyles["t5_day_table"].GridColumnStyles[0] as
DataGridTextBoxColumn;

and it's been displaying the date time with this format dd/MM/yy hh:mm:ss...

The datagrid is being filled with a dataSet and I wanted it to get the date
check if it's today's date, if it's true then in spite of have dd/MM/yy
hh:mm:ss I would like the format hh:mm:ss

How can I do that, I've tried lot's of times and I didn't done it...

Thanks in Advance
 
Hi,

Derive your own column style from DataGridTextBoxColumn, override the Paint
method overloads, and implement your own logic of formatting the value to a
string, then call PaintText to have the actual painting done.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


"Diogo Alves - Software Developer"
 
Back
Top