Formating DateTime Cells on Datagrid

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
 
D

Dmytro Lapshyn [MVP]

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top