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

    <P>Hi, I am using Win Spread vs2.5 for VS.NET 2003</P>
    <P>I want to allow certain row to be AllowRowMove = true, how can i do this ?</P>
    <P>Example:</P>
    <P>I have a spreadsheet with 3 column and 3 row</P>
    <P>------------------------------------------------------</P>
    <P><FONT><STRONG>Name            Company               IsTrialVersion</STRONG></FONT></P>
    <P>----------------------------------------------------</P>
    <P>Nabin            WebSpark               No</P>
    <P>---------------------------------------------------</P>
    <P>San                  XYZ                     Yes</P>
    <P>--------------------------------------------------</P>
    <P>Mark               YYY                     No</P>
    <P>-------------------------------------------------</P>
    <P> </P>
    <P>in above spread sheet i should able to move the rows where IsTrail = Yes and the row with IsTrail = No will be fixed.</P>
    <P>Please help me out.</P>
    <P> </P>
  • Replied 8 September 2017, 12:27 pm EST

    There's not a real clean way to do this but you can do the following...<br><br>Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick<br>If e.RowHeader And e.Row = 1 Then<br>FpSpread1.AllowRowMove = True<br>Else<br>FpSpread1.AllowRowMove = False<br>'e.Cancel = True<br>End If<br>End Sub<br><br>I'll let you decide if you want to use the e.Cancel parameter.  <br>
  • Replied 8 September 2017, 12:27 pm EST

    <P>Thats Great  Bob</P>
    <P>here is my modified code</P>
    <P><FONT color=#0000ff><SPAN class=kwd>Private Sub</SPAN> FpSpread1_CellClick(<SPAN class=kwd>ByVal</SPAN> sender <SPAN class=kwd>As Object</SPAN>, <SPAN class=kwd>ByVal</SPAN> e <SPAN class=kwd>As</SPAN> FarPoint.Win.Spread.CellClickEventArgs) <SPAN class=kwd>Handles</SPAN> FpSpread1.CellClick<BR>        <SPAN class=kwd>If</SPAN> e.RowHeader </FONT><FONT color=#0000ff><SPAN class=kwd>Then<BR>            If</SPAN> FpSpread1.ActiveSheet.Cells(e.Row, 2).Value = <SPAN class=st>"No"</SPAN> <SPAN class=kwd>Then</SPAN><BR>                FpSpread1.AllowRowMove = </FONT><FONT color=#0000ff><SPAN class=kwd>True<BR>            Else</SPAN><BR>                FpSpread1.AllowRowMove = </FONT><FONT color=#0000ff><SPAN class=kwd>False<BR>            End If<BR>        Else</SPAN><BR>            FpSpread1.AllowRowMove = </FONT><SPAN class=kwd><FONT color=#0000ff>False<BR>        End If<BR>End Sub</FONT></SPAN></P> 
  • Replied 8 September 2017, 12:27 pm EST

    <P>Hello,</P>
    <P>You would need to cancel the RowDragMove event if you do not want a particular row to be moved.</P> <PRE class=coloredcode> <SPAN class=kwd>Private Sub</SPAN> FpSpread1_RowDragMove(<SPAN class=kwd>ByVal</SPAN> sender <SPAN class=kwd>As Object</SPAN>, <SPAN class=kwd>ByVal</SPAN> e <SPAN class=kwd>As</SPAN> FarPoint.Win.Spread.DragMoveEventArgs) <SPAN class=kwd>Handles</SPAN> FpSpread1.RowDragMove
    <SPAN class=kwd>If</SPAN> e.Index = 3 <SPAN class=kwd>Then</SPAN> e.Cancel = <SPAN class=kwd>True
    End Sub</SPAN></PRE> 
Need extra support?

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

Learn More

Forum Channels