AutoSizeRowsModeChanged Event
Collapse the table of content
Expand the table of content

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 AutoSizeRowsModeChanged As DataGridViewAutoSizeModeEventHandler

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

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 Sub WatchRowsModeChanges(ByVal sender As Object, _
    ByVal modeEvent As DataGridViewAutoSizeModeEventArgs) _
    Handles DataGridView1.AutoSizeRowsModeChanged

    Dim label As Label = CType(FlowLayoutPanel1.Controls _
        (currentLayoutName), Label)

    If modeEvent.PreviousModeAutoSized Then
        label.Text = "changed to different " & label.Name & _
        label.Text = label.Name & _
    End If
End Sub

.NET Framework
Available since 2.0
Return to top
© 2016 Microsoft