How to determine the cell type of a column?

Posted by: ge0force on 8 September 2017, 2:32 pm EST

  • Posted 8 September 2017, 2:32 pm EST

    What I'm trying to do is only show the up-down buttons in a cell in editmode, and only if it's a time-cell.

    My code:

    <font color="#0000ff">    Private Sub FpSpread1_EditModeOn(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOn

            Dim current As FarPoint.Win.Spread.FpSpread = CType(sender, FarPoint.Win.Spread.FpSpread)

            If current.ActiveSheet.GetCellType(current.ActiveSheet.ActiveRow.Index, current.ActiveSheet.ActiveColumn.Index) Is GetType(FarPoint.Win.Spread.CellType.DateTimeCellType) Then
                 ' Do stuff...
            End If

       End Sub</font>

    This does not seem to work, since the GetCellType equation is always false.

    What do I do wrong?



  • Replied 8 September 2017, 2:32 pm EST


    Here is the code you can use to accomplish the desired scenario:
      Dim ct As FarPoint.Win.Spread.CellType.ICellType
            ct = FpSpread1.ActiveSheet.GetCellType(FpSpread1.ActiveSheet.ActiveRowIndex, FpSpread1.ActiveSheet.ActiveColumnIndex)
            If TypeOf ct Is FarPoint.Win.Spread.CellType.DateTimeCellType Then
                'code here
            End If

  • Replied 8 September 2017, 2:32 pm EST

    Thankx a lot for the fast response!
Need extra support?

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

Learn More

Forum Channels