Allow Row Moving for particular ROW in Spread Sheet.

Posted by: nabinpadhi on 8 September 2017, 12:27 pm EST

  • Posted 8 September 2017, 12:27 pm EST

    Hi, I am using Win Spread vs2.5 for VS.NET 2003


    I want to allow certain row to be AllowRowMove = true, how can i do this ?


    Example:


    I have a spreadsheet with 3 column and 3 row


    ------------------------------------------------------


    Name            Company               IsTrialVersion


    ----------------------------------------------------


    Nabin            WebSpark               No


    ---------------------------------------------------


    San                  XYZ                     Yes


    --------------------------------------------------


    Mark               YYY                     No


    -------------------------------------------------


     


    in above spread sheet i should able to move the rows where IsTrail = Yes and the row with IsTrail = No will be fixed.


    Please help me out.


     

  • Replied 8 September 2017, 12:27 pm EST

    There's not a real clean way to do this but you can do the following...

    Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick
    If e.RowHeader And e.Row = 1 Then
    FpSpread1.AllowRowMove = True
    Else
    FpSpread1.AllowRowMove = False
    'e.Cancel = True
    End If
    End Sub

    I'll let you decide if you want to use the e.Cancel parameter. 
  • Replied 8 September 2017, 12:27 pm EST

    Thats Great  Bob


    here is my modified code


    Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick
            If e.RowHeader
    Then
                If
    FpSpread1.ActiveSheet.Cells(e.Row, 2).Value = "No" Then
                    FpSpread1.AllowRowMove =
    True
                Else

                    FpSpread1.AllowRowMove =
    False
                End If
            Else

                FpSpread1.AllowRowMove =
    False
            End If
    End Sub

     
  • Replied 8 September 2017, 12:27 pm EST

    Hello,


    You would need to cancel the RowDragMove event if you do not want a particular row to be moved.

     
      Private Sub FpSpread1_RowDragMove(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.DragMoveEventArgs) Handles FpSpread1.RowDragMove
    If e.Index = 3 Then e.Cancel = True
    End Sub
     
Need extra support?

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

Learn More

Forum Channels