Home › Forums › WinForms controls › Xceed Grid for WinForms › Date value of 0001-01-01 displays as Null
I have a grid column defined as DateTime. If I attempt to set a cell to a value of 0001-01-01 (eg. 1st of January 0001) then the value displays as Null.
My code is:
c.Value = CDate(dataval) ‘ dataval is a string variable with value ‘0001-01-01’
At the end of this:
c.Value is Date: #12:00:00 AM#
c.GetDisplayText is “NULL” (which is the value of c.NullText)
0001-01-01 is a valid date and should display OK in the grid.
Imported from legacy forums. Posted by Phil (had 1898 views)
You can set the NullText value on the Column so that it will reflect the minimum value. In the following code, the column will display your desired output.
DateTime dt = new DateTime(); dt.AddDays(1d); dt.AddMonths(1); dt.AddYears(1);
this.gridControl1.BeginInit(); this.gridControl1.Columns[“Column7”].NullText = dt.ToString();
Imported from legacy forums. Posted by Marc [Xceed] (had 1225 views)