Hiding Columns

Posted by: sidso on 8 September 2017, 12:59 pm EST

  • Posted 8 September 2017, 12:59 pm EST


    I have a requirement for my project where on right click on any one of the cells of the spread i get a context menu which has a "Hide" option in it. On clicking this hid option i need to hide the entire column in the spread. There is another option "Show column" , clicking on which i should be able to see the hidden columns. How do i achieve this ... can somebody help me out !!!




  • Replied 8 September 2017, 12:59 pm EST

    sid -

    In my test I used a ContextMenuStrip.  You have to set the active cell in the click of the spread to get the correct column to delete.

    FpSpread1.ContextMenuStrip = ContextMenuStrip1

    Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick
    If e.Button = Windows.Forms.MouseButtons.Right Then
    FpSpread1.ActiveSheet.SetActiveCell(e.Row, e.Column)
    End If
    End Sub

    Private Sub HideToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HideToolStripMenuItem.Click
    FpSpread1.ActiveSheet.Columns(FpSpread1.ActiveSheet.ActiveColumnIndex).Visible = False
    End Sub

    To see the hidden columns you would have to loop through the columns checking the Visible property and if it is False then set it to
  • Replied 8 September 2017, 12:59 pm EST

    Hi scott,

    Thank you,




Need extra support?

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

Learn More

Forum Channels