How to Prevent Resizing a Specific Column in Windows Forms GridControl
15 Jun 20211 minute to read
Introduction
Handle ResizingColumns event and cancel the resizing for specific columns.
//Handles ResizingColumns event.
private void grid_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
//Disables Column Resizing for the third column from the Right.
if(e.Columns.Right == 2)
{
e.Cancel = true;
}
}
'Handles ResizingColumns event.
Private Sub grid_ResizingColumns(ByVal sender As Object, ByVal e As GridResizingColumnsEventArgs)
//Disables Column Resizing for the third column from the Right.
If e.Columns.Right = 2 Then
e.Cancel = True
End If
End Sub