how to delete selected row

Posted by: redahashem-fp on 8 September 2017, 2:03 pm EST

  • Posted 8 September 2017, 2:03 pm EST

    <P>i know when i need to delete row</P><FONT size=2>
    <P>FpSpread1.Sheets(0).Rows.Count - = 1</P>
    <P>but that will delete the last row</P>
    <P>i need to delete the active row or selected row</P>
    <P>thanks 4 help</P>
    <P> </P></FONT>
  • Replied 8 September 2017, 2:03 pm EST

    <p>Hello,</p><p>To delete the selected row, you can use the following:</p><blockquote><p>        Dim cr As FarPoint.Win.Spread.Model.CellRange<br>        cr = FpSpread1.Sheets(0).GetSelection(0)<br>        FpSpread1.Sheets(0).RemoveRows(cr.Row, cr.RowCount)</p></blockquote><p>Thanks<br></p>
  • Replied 8 September 2017, 2:03 pm EST

    <BLOCKQUOTE><div><img src="/wp-content/uploads/CS_images/icon-quote.gif"> SureshD:</div><div>
    <P>Hello,</P>
    <P>To delete the selected row, you can use the following:</P>
    <BLOCKQUOTE>
    <P>        Dim cr As FarPoint.Win.Spread.Model.CellRange<BR>        cr = FpSpread1.Sheets(0).GetSelection(0)<BR>        FpSpread1.Sheets(0).RemoveRows(cr.Row, cr.RowCount)</P></BLOCKQUOTE>
    <P>Thanks<BR></P>
    <P></div></BLOCKQUOTE></P>
    <P> </P>
    <P>that gives me error but i try that and worked nice</P><FONT size=2>
    <P>FpSpread1.Sheets(0).ActiveRow.Remove()</P>
    <P>that code deleted the active row</P></FONT>
  • Replied 8 September 2017, 2:03 pm EST

    <p>Hello,</p><p>Thank you for letting us know that you were able to get the desired behavior. However, my code snippet is working fine at my side and it deletes the selected row/rows from the sheet, whereas your snippet removes the ActiveRow (which is currently selected).</p><p>Thanks<br></p>
Need extra support?

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

Learn More

Forum Channels