Hi,

I have a situation where I need to only display the month and day of a
specific date in my Datagrid Column while keeping the underlying value
(which includes the year) intact.

I am currently using a DataGridTimePickerColumn class I got from the
Microsoft website to create DateTimePickers in each row of my date
column. I am able to format the date how I want ("MM/dd") when the
user clicks on the DateTimePicker. But after they have entered the
date, the value (including the year) appears in the datagrid.

I've been trying to use the dataview to accomplish my goal of only
displaying the month and day to the user while keeping the whole date
intact in my datatable. But I have not been able to figure out how to
do this. Is what I am trying to do even possible?? And if so, does
anyone have any ideas of how I can do it??

Thank you!

Joy

Re: Custom Date Format for VB.NET Datagrid Column by Dmytro

Dmytro
Wed Apr 27 03:31:33 CDT 2005

Hi,

For the standard text column, such tricks can be achieved by supplying your
own Format string or even your own IFormatProvider instance by setting
appropriate properties of the column style (namely Format and FormatInfo).
Hopefully there are similar properties on the DateTimePicker column. If not,
derive a new column style, introduce these properties and use them in the
overloaded Paint method.

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


<simchajoy2000@yahoo.com> wrote in message
news:1114551893.613988.155060@f14g2000cwb.googlegroups.com...
> Hi,
>
> I have a situation where I need to only display the month and day of a
> specific date in my Datagrid Column while keeping the underlying value
> (which includes the year) intact.
>
> I am currently using a DataGridTimePickerColumn class I got from the
> Microsoft website to create DateTimePickers in each row of my date
> column. I am able to format the date how I want ("MM/dd") when the
> user clicks on the DateTimePicker. But after they have entered the
> date, the value (including the year) appears in the datagrid.
>
> I've been trying to use the dataview to accomplish my goal of only
> displaying the month and day to the user while keeping the whole date
> intact in my datatable. But I have not been able to figure out how to
> do this. Is what I am trying to do even possible?? And if so, does
> anyone have any ideas of how I can do it??
>
> Thank you!
>
> Joy
>


Re: Custom Date Format for VB.NET Datagrid Column by simchajoy2000

simchajoy2000
Wed Apr 27 10:31:31 CDT 2005

You are correct, Format properties are not provided for the
DateTimePicker column. I like your suggestion of creating a custom
column style, however, I'm not entirely sure where to begin. Is there
some example code out there that could help to guide me?

Thank you!

Joy


Re: Custom Date Format for VB.NET Datagrid Column by Dmytro

Dmytro
Wed Apr 27 12:13:07 CDT 2005

Yes, in the MSDN docs on the DataGridColumnStyle class.

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


<simchajoy2000@yahoo.com> wrote in message
news:1114615891.117068.265520@z14g2000cwz.googlegroups.com...
> You are correct, Format properties are not provided for the
> DateTimePicker column. I like your suggestion of creating a custom
> column style, however, I'm not entirely sure where to begin. Is there
> some example code out there that could help to guide me?
>
> Thank you!
>
> Joy
>


Re: Custom Date Format for VB.NET Datagrid Column by simchajoy2000

simchajoy2000
Wed Apr 27 12:47:22 CDT 2005

Thanks a lot! That was just what I needed!