I create a WinForm app with some DataGridView controls using VB2005.
I have a dataTable(dt1) contains, among other, some date columns.
However, due to locally we represent date as dd/MM/yyyy format,
I have written an additional function to create yet another
dataTable (dt2) to replace the those date columns with string columns
of dd/MM/yyyy. I then set DGV dataSource to this second table (dt2).
If I were to create addition dataTables for every datatables that contain
DateTime column(s), this will cause my program consume many extra resources.
Is there any other alternative to show the date columns in DGV in custom
format (dd/MM/yyyy) without recreating an extra datatable? I would
like to retain the date columns in dataTable for other purposes.
Thanks for your reply.
Hi,
>I create a WinForm app with some DataGridView controls using VB2005.
> I have a dataTable(dt1) contains, among other, some date columns.
[quoted text clipped - 9 lines]
> Is there any other alternative to show the date columns in DGV in custom
> format (dd/MM/yyyy) without recreating an extra datatable? I would
Have a look at the DataGridView column editor, see
DefaultCellStyle->Format->Custom. If the DGV can't auto parse your format
(haven't tried) then you'll have to handle DGV.CellParsing event and do the
parsing yourself. If your column is readonly then you don't have to care
about parsing...
---
HTH,
Greetings
> like to retain the date columns in dataTable for other purposes.
>
> Thanks for your reply.
pedestrian - 18 Sep 2006 03:59 GMT
Hi, Bart. I tried the CellParsing as you mentioned
(using example from MSDN). I don't get the expected result
perhaps I program it wrongly.
However, It then hinted me to try the CellFormatting
exp. from MSDN and I got the issue solved! :)
Thanks for you assitance.

Signature
Regards,
Pedestrian, Penang.