DataGridViewCellStyle.ApplyStyle Method (DataGridViewCellStyle)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Applies the specified DataGridViewCellStyle to the current DataGridViewCellStyle.

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

public virtual void ApplyStyle(
	DataGridViewCellStyle dataGridViewCellStyle


Type: System.Windows.Forms.DataGridViewCellStyle

The DataGridViewCellStyle to apply to the current DataGridViewCellStyle.

Exception Condition

dataGridViewCellStyle is null.

The ApplyStyle method applies the values of the properties that are set in the dataGridViewCellStyle parameter to the current DataGridViewCellStyle. If a property is not set in dataGridViewCellStyle, the current DataGridViewCellStyle retains its value of that property.

.NET Framework
Available since 2.0
Return to top