How to disable multiple selection of cells in WinForms GridControl?
Disable the multiple range selection
To disable the multiple range selection of cells for a particular column in WinForms Grid, 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
Conclusion
I hope you enjoyed learning about how to disable multiple selection of cells in WinForms GridControl.
You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!