Highlighting SelectedRow

Posted by: hpadmasola1 on 8 September 2017, 2:18 pm EST

  • Posted 8 September 2017, 2:18 pm EST


    I want to be able select the complete row and also highlight the selected row in Yellow. I tried the following two lines of code. It does not seem to work. is the code below correct ? Any guidance is appreciated.


    fpSpread1.Sheets(0).SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row


    fpSpread1.Sheets(0).SelectionBackColor = Color.Yellow


     Thanks


    Harish

  • Replied 8 September 2017, 2:18 pm EST

    Hello Harish,


    You need to set SelectionStyle property of Sheets to SelectionColors as well along with other properties.



                fpSpread1.Sheets(0).SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row
                fpSpread1.Sheets(0).SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors
                fpSpread1.Sheets(0).SelectionBackColor = Color.Yellow


    Hope this will help you. Thanks.

  • Replied 8 September 2017, 2:18 pm EST

    This worked but the Selected Cell is still in white. I want the whole row to be in yellow including the selected cell.  How do I make that yellow as well ?


    harish

  • Replied 8 September 2017, 2:18 pm EST

    Hello Harish,

    In addition to the above code you may add the some code in Spread's LeaveCell event to set the backcolor for selected cell and to reset it while leaving the cell.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            FpSpread1.Sheets(0).SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row
            FpSpread1.Sheets(0).SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors
            FpSpread1.Sheets(0).SelectionBackColor = Color.Yellow
        End Sub

        Private Sub FpSpread1_LeaveCell(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.LeaveCellEventArgs) Handles FpSpread1.LeaveCell
            FpSpread1.ActiveSheet.Cells(e.NewRow, e.NewColumn).BackColor = Color.Yellow
            FpSpread1.ActiveSheet.Cells(e.Row, e.Column).BackColor = Color.White
        End Sub

    I hope it will help you.

    Thanks,

     

Need extra support?

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

Learn More

Forum Channels