Empty text for not initialized DateTime values

Posted by: itshim on 8 September 2017, 1:57 pm EST

  • Posted 8 September 2017, 1:57 pm EST

    Hi there,

    We have Grid binded to datatable. The problem is with theDataTime field. In DataRows, we initialize default  DateTime type of values to lowest DateTimevalue. And Spread as expected shows that DateTime value.

    What we would like is to configure Spread in such a way thatthese minimal value of DateTime be displayed as empty string. Is there a way?

    If not, what is the usual scenario that you would recommenddealing with datetime columns? The goal is that Spread should display emptytext for not initialized date objects.


    Thank you.  

  • Replied 8 September 2017, 1:57 pm EST


    Defining the celltype as DateTimeCellType you can set the Minimum Date property for the DateTime Field to the Desired minimum value of date.Below is the code snippet that does the same,

    Dim dttype As New FarPoint.Win.Spread.CellType.DateTimeCellType

    Dim ds As New DataSet()

    Dim per As New DataTable("Person")



    per.Columns.Add("Date Joined")

    per.Rows.Add(New Object() {"John", "Smith", ""})

    per.Rows.Add(New Object() {"Alex", "Mendez", ""})

    ds.Tables.AddRange(New DataTable() {per})

    fpSpread1.DataSource = ds

    FpSpread1.DataMember = "Person"

    FpSpread1.ActiveSheet.Columns(2).CellType = dttype

    dttype.MinimumDate = New System.DateTime(2008, 12, 31)


    Hope it will help you.


  • Replied 8 September 2017, 1:57 pm EST

    In addition to the above you can create a custom celltype and override the PaintCell method to look for when the value parameter is the minimum data. When this happens, change the value to an empty string.




Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels