)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to disable the multiple selection of cells for a particular column in WinForms GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: April 21, 2015 |
Last Revised Date: December 19, 2019
Tags: selection

Disable the multiple range selection

To disable the multiple range selection of cells for a particular column, you need to cancel the SelectionChanging event. The following code explains about how to disable the selection for second column.

C#

this.gridControl1.SelectionChanging += gridControl1_SelectionChanging
void gridControl1_SelectionChanging(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs e)
{
    //consider 2nd column as OrginalTextBox celltype.
    if (e.Reason == GridSelectionReason.MouseMove && e.ClickRange.Left == 2)
    {
        e.Cancel = true;
    }
}

 

VB

Private Me.gridControl1.SelectionChanging += AddressOf gridControl1_SelectionChanging
Private Sub gridControl1_SelectionChanging(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs)
  'Consider 2nd column as OrginalTextBox celltype.
  If e.Reason = GridSelectionReason.MouseMove AndAlso e.ClickRange.Left = 2 Then
    e.Cancel = True
  End If
End Sub

Samples:

C#: Selection

VB: Selection

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon