Collapse the table of content
Expand the table of content
Expand Minimize

DataGridView.AutoSizeRowsModeChanged Event


Occurs when the value of the DataGridViewAutoSizeRowsMode property changes.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event DataGridViewAutoSizeModeEventHandler AutoSizeRowsModeChanged

For more information about handling events, see NIB: Consuming Events.

Legacy Code Example

The following code example illustrates the use of this event. This example is part of a larger example available in How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control.

private void WatchRowsModeChanges(object sender,
    DataGridViewAutoSizeModeEventArgs modeEvent)
    Label label =

    if (modeEvent.PreviousModeAutoSized)
        label.Text = "changed to a different " +
            label.Name +
        label.Text = label.Name +

.NET Framework
Available since 2.0
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft