Re: Format grid column to display "" instead of datetime DBNull (1
- From: "Carlos Lozano" <CarlosLozano@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 20 Jul 2005 14:06:04 -0700
Hi Chris,
The error is at runtime. It says "object not set to an instance". I know
the grid is not the problem as I can see it after it is populated.
I think it refers to the TableStyles object within the Grid. I Added the
following line to verify:
int nStyles = oGrid.TableStyles.Count;
nStyles value is zero. I was expecting a value of 1 as the grid was
populated from a table.
Just in case you are wondering, the column formatting setGridColumnStyle()
is called after the grid is populated.
Any Ideas?
Thank you,
Carlos Lozano
"Chris" wrote:
> Carlos Lozano wrote:
> > Hello Folks!
> >
> > I have a grid that populates from a table on SQL Server. All datetime with
> > DBNull value show 1/1/1900 12:00AM ... Instead of just blank ("").
> >
> > I found a document with the following code, but didn't work.
> >
> > public void setGridColumnStyle()
> > {
> > DataGridColumnStyle newColStyle;
> > newColStyle = oGrid.TableStyles[0].GridColumnStyles[0];
> > newColStyle.NullText = "";
> > }
> >
> > I tried to customize it to my needs as below:
> > public void setGridColumnStyle(ref System.Windows.Forms.Grid oGrid, string
> > sTable, string sColumn)
> > {
> > DataGridColumnStyle newColStyle;
> > newColStyle = oGrid.TableStyles[sTable].GridColumnStyles[sColumn];
> > newColStyle.NullText = "";
> > }
> >
> > I always got an error on second line.
> >
> > I will appreciate any help to do this.
> >
> > Carlos Lozano
> > www.caxonline.net
>
>
> What is the error? Is the error at runtime or design time...
>
> Chris
>
.
- Follow-Ups:
- References:
- Prev by Date: Process & OutputDataReceived Handler
- Next by Date: Re: Com component
- Previous by thread: Re: Format grid column to display "" instead of datetime DBNull (1/1/1
- Next by thread: Re: Format grid column to display "" instead of datetime DBNull (1
- Index(es):
Relevant Pages
|