Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataGridViewSelectedColumnCollection Class

Represents a collection of DataGridViewColumn objects that are selected in a DataGridView.

System.Object
  System.MarshalByRefObject
    System.Windows.Forms.BaseCollection
      System.Windows.Forms.DataGridViewSelectedColumnCollection

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
[ListBindableAttribute(false)]
public class DataGridViewSelectedColumnCollection : BaseCollection, 
	IList, ICollection, IEnumerable

The DataGridViewSelectedColumnCollection type exposes the following members.

  NameDescription
Public propertyCountGets the total number of elements in the collection. (Inherited from BaseCollection.)
Public propertyIsReadOnlyGets a value indicating whether the collection is read-only. (Inherited from BaseCollection.)
Public propertyIsSynchronizedGets a value indicating whether access to the ICollection is synchronized. (Inherited from BaseCollection.)
Public propertyItemGets the column at the specified index.
Protected propertyListGets the list of elements contained in the BaseCollection instance. (Overrides BaseCollection.List.)
Public propertySyncRootGets an object that can be used to synchronize access to the BaseCollection. (Inherited from BaseCollection.)
Top
  NameDescription
Public methodClearInfrastructure. Clears the collection.
Public methodContainsDetermines whether the specified column is contained in the collection.
Public methodCopyTo(Array, Int32)Copies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at the specified destination Array index. (Inherited from BaseCollection.)
Public methodCopyTo(DataGridViewColumn[], Int32)Copies the elements of the collection to the specified array, starting at the specified index.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetEnumeratorGets the object that enables iterating through the members of the collection. (Inherited from BaseCollection.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodInsertInfrastructure. Inserts a column into the collection at the specified position.
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top
  NameDescription
Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top
  NameDescription
Explicit interface implemetationPrivate methodICollection.CopyToCopies the elements of the collection to the specified array, starting at the specified index.
Explicit interface implemetationPrivate propertyICollection.CountGets the number of elements in the collection.
Explicit interface implemetationPrivate propertyICollection.IsSynchronizedInfrastructure. Gets a value indicating whether access to the collection is synchronized (thread safe).
Explicit interface implemetationPrivate propertyICollection.SyncRootGets an object that can be used to synchronize access to the collection.
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorReturns an enumerator that iterates through a collection.
Explicit interface implemetationPrivate methodIList.AddInfrastructure. Implements the IList.Add method. Always throws NotSupportedException.
Explicit interface implemetationPrivate methodIList.ClearInfrastructure. Implements the IList.Clear method. Always throws NotSupportedException.
Explicit interface implemetationPrivate methodIList.ContainsDetermines whether the specified value is contained in the collection.
Explicit interface implemetationPrivate methodIList.IndexOfReturns the index of the specified element.
Explicit interface implemetationPrivate methodIList.InsertInfrastructure. Implements the IList.Insert method. Always throws NotSupportedException.
Explicit interface implemetationPrivate propertyIList.IsFixedSizeInfrastructure. Gets a value indicating whether the collection has a fixed size.
Explicit interface implemetationPrivate propertyIList.IsReadOnlyInfrastructure. Gets a value indicating whether the collection is read-only.
Explicit interface implemetationPrivate propertyIList.ItemInfrastructure. Gets the element at the specified index.
Explicit interface implemetationPrivate methodIList.RemoveImplements the Remove method. Always throws NotSupportedException.
Explicit interface implemetationPrivate methodIList.RemoveAtInfrastructure. Implements the RemoveAt method. Always throws NotSupportedException.
Top

The order of columns in the collection is not guaranteed to match the order in which they were selected.

The DataGridViewSelectedColumnCollection does not perform efficiently when working with large numbers of columns. Typically, DataGridView controls will not contain enough columns for this to be an issue, but if you are working with large numbers of columns, you can use the DataGridView.AreAllCellsSelected to determine if the entire grid is selected, or you can use the DataGridViewColumnCollection.GetColumnCount to determine the number of selected columns (or the number of columns in a specified state). For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft. All rights reserved.