Ok. Can you give me some sample code on how to do this.
I'll attach some code I have so far so you can add the
rest to get the formatting code
GRID.TableStyles(rownum).GridColumnStyles("Date")...
Thank you,
Sebastian
-----Original Message-----
Sebastian,
You just haven't dug deep enough
The GridColumnStyles
collection is just
the right direction to pursue, and the next step would
get you just where
you want to be. See below.
FormatInfo is set on
System.Windows.Forms.DataGridColumnStyle class. This is
actually an abstract class, and has two implementations
by default -
DataGridTextBoxColumn and DataGridBoolColumn. As both of
these classes
inherit from DataGridColumnStyle, they obviosuly have
Format and FormatInfo
properties you can customize to achieve a desirable data
format.
And the GridColumnStyles collection contains just these
DataGridTextBoxColumns and DataGridBoolColumns.
Unfortunately, when the
columns are generated automatically, you cannot access
the column style
instances created behind the scenes. Therefore, you will
need to specify a
set of columns manually, and it is easily done with the
GridColumnStyles
collection designer.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
message
I don't know where your getting FormatInfo property from
but it doesn't exist for DataGridTableStyle object for
VB .net 2002. I've attached it to my datagrid as a
TableStyles.
The closest thing I could find in that was
DataGridTableStyle.GridColumnStyles
and it had no formating property.
Can someone advice how I get to this format property?
Thank you,
Seb
-----Original Message-----
Hi Sebastian,
Initialize the FormatInfo property for the
corresponding
DataGridColumnStyle
with a pre-created DateTimeFormatInfo instance. You can
probably achieve the
same effect by playing just with the
DataGridColumnStyle.Format property (if
an existing time-only format exists or can be specified
with a tailormade
format string).
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
in
message
How do I get a datetime field from a database to show
just
time in the datagrid. The default just shows date.
Thank you
Sebastian
.
.