DataGridView.CellBorderStyle Property

 
System_CAPS_noteNote

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

Gets the cell border style for the DataGridView.

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

[<BrowsableAttribute(true)>]
member CellBorderStyle : DataGridViewCellBorderStyle with get, set

Property Value

Type: System.Windows.Forms.DataGridViewCellBorderStyle

A DataGridViewCellBorderStyle that represents the border style of the cells contained in the DataGridView.

Exception Condition
InvalidEnumArgumentException

The specified value when setting this property is not a valid DataGridViewCellBorderStyle value.

ArgumentException

The specified value when setting this property is Custom.

If the CellBorderStyle property is set to anything other than Single, SingleHorizontal, or SingleVertical, the GridColor property must be a system color.

You cannot set this property to the Custom value, which is a read-only value indicating that the cell border style has been customized through the use of the AdvancedCellBorderStyle property.

The following code example demonstrates how to use the CellBorderStyle property. To run this example, paste the code into a form that contains a DataGridView named dataGridView1, and then call the SetUpDataGridView method from the form's constructor or Load event handler. Ensure all events are associated with their event handlers.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: