DataGridViewColumnCollection.RemoveAt(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes the column at the given index in the collection.
public:
virtual void RemoveAt(int index);
public virtual void RemoveAt (int index);
abstract member RemoveAt : int -> unit
override this.RemoveAt : int -> unit
Public Overridable Sub RemoveAt (index As Integer)
Parameters
- index
- Int32
The index of the column to delete.
Exceptions
index
is less than zero or greater than the number of columns in the control minus one.
The associated DataGridView control is performing one of the following actions that temporarily prevents new columns from being added:
Selecting all cells in the control.
Clearing the selection.
Updating column DisplayIndex property values.
-or-
This method is being called from a handler for one of the following DataGridView events:
Remarks
To remove a column that is automatically generated when binding to a data source, call this method in a DataGridView.DataBindingComplete event handler.