DataGridView Class

Displays data in a customizable grid.

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

[ComplexBindingPropertiesAttribute("DataSource", "DataMember")]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[DockingAttribute(DockingBehavior.Ask)]
public class DataGridView : Control, 
	ISupportInitialize

The DataGridView type exposes the following members.

  NameDescription
Public methodDataGridViewInitializes a new instance of the DataGridView class.
Top

  NameDescription
Public propertyAccessibilityObjectGets the AccessibleObject assigned to the control. (Inherited from Control.)
Public propertyAccessibleDefaultActionDescriptionGets or sets the default action description of the control for use by accessibility client applications. (Inherited from Control.)
Public propertyAccessibleDescriptionGets or sets the description of the control used by accessibility client applications. (Inherited from Control.)
Public propertyAccessibleNameGets or sets the name of the control used by accessibility client applications. (Inherited from Control.)
Public propertyAccessibleRoleGets or sets the accessible role of the control (Inherited from Control.)
Public propertyAdjustedTopLeftHeaderBorderStyleGets the border style for the upper-left cell in the DataGridView.
Public propertyAdvancedCellBorderStyleGets the border style of the cells in the DataGridView.
Public propertyAdvancedColumnHeadersBorderStyleGets the border style of the column header cells in the DataGridView.
Public propertyAdvancedRowHeadersBorderStyleGets the border style of the row header cells in the DataGridView.
Public propertyAllowDropGets or sets a value indicating whether the control can accept data that the user drags onto it. (Inherited from Control.)
Public propertyAllowUserToAddRowsGets or sets a value indicating whether the option to add rows is displayed to the user.
Public propertyAllowUserToDeleteRowsGets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
Public propertyAllowUserToOrderColumnsGets or sets a value indicating whether manual column repositioning is enabled.
Public propertyAllowUserToResizeColumnsGets or sets a value indicating whether users can resize columns.
Public propertyAllowUserToResizeRowsGets or sets a value indicating whether users can resize rows.
Public propertyAlternatingRowsDefaultCellStyleGets or sets the default cell style applied to odd-numbered rows of the DataGridView.
Public propertyAnchorGets or sets the edges of the container to which a control is bound and determines how a control is resized with its parent. (Inherited from Control.)
Public propertyAutoGenerateColumnsGets or sets a value indicating whether columns are created automatically when the DataSource or DataMember properties are set.
Public propertyAutoScrollOffsetGets or sets where this control is scrolled to in ScrollControlIntoView. (Inherited from Control.)
Public propertyAutoSizeThis property is not relevant for this class. (Overrides Control.AutoSize.)
Public propertyAutoSizeColumnsModeGets or sets a value indicating how column widths are determined.
Public propertyAutoSizeRowsModeGets or sets a value indicating how row heights are determined.
Public propertyBackColorInfrastructure. Gets or sets the background color for the control. (Overrides Control.BackColor.)
Public propertyBackgroundColorGets or sets the background color of the DataGridView.
Public propertyBackgroundImageInfrastructure. Gets or sets the background image displayed in the control. (Overrides Control.BackgroundImage.)
Public propertyBackgroundImageLayoutInfrastructure. Gets or sets the background image layout as defined in the ImageLayout enumeration. (Overrides Control.BackgroundImageLayout.)
Public propertyBindingContextGets or sets the BindingContext for the control. (Inherited from Control.)
Public propertyBorderStyleGets or sets the border style for the DataGridView.
Public propertyBottomGets the distance, in pixels, between the bottom edge of the control and the top edge of its container's client area. (Inherited from Control.)
Public propertyBoundsGets or sets the size and location of the control including its nonclient elements, in pixels, relative to the parent control. (Inherited from Control.)
Protected propertyCanEnableImeGets a value indicating whether the ImeMode property can be set to an active value, to enable IME support. (Overrides Control.CanEnableIme.)
Public propertyCanFocusGets a value indicating whether the control can receive focus. (Inherited from Control.)
Protected propertyCanRaiseEventsDetermines if events can be raised on the control. (Inherited from Control.)
Public propertyCanSelectGets a value indicating whether the control can be selected. (Inherited from Control.)
Public propertyCaptureGets or sets a value indicating whether the control has captured the mouse. (Inherited from Control.)
Public propertyCausesValidationGets or sets a value indicating whether the control causes validation to be performed on any controls that require validation when it receives focus. (Inherited from Control.)
Public propertyCellBorderStyleGets the cell border style for the DataGridView.
Public propertyClientRectangleGets the rectangle that represents the client area of the control. (Inherited from Control.)
Public propertyClientSizeGets or sets the height and width of the client area of the control. (Inherited from Control.)
Public propertyClipboardCopyModeGets or sets a value that indicates whether users can copy cell text values to the Clipboard and whether row and column header text is included.
Public propertyColumnCountGets or sets the number of columns displayed in the DataGridView.
Public propertyColumnHeadersBorderStyleGets the border style applied to the column headers.
Public propertyColumnHeadersDefaultCellStyleGets or sets the default column header style.
Public propertyColumnHeadersHeightGets or sets the height, in pixels, of the column headers row
Public propertyColumnHeadersHeightSizeModeGets or sets a value indicating whether the height of the column headers is adjustable and whether it can be adjusted by the user or is automatically adjusted to fit the contents of the headers.
Public propertyColumnHeadersVisibleGets or sets a value indicating whether the column header row is displayed.
Public propertyColumnsGets a collection that contains all the columns in the control.
Public propertyCompanyNameGets the name of the company or creator of the application containing the control. (Inherited from Control.)
Public propertyContainerGets the IContainer that contains the Component. (Inherited from Component.)
Public propertyContainsFocusGets a value indicating whether the control, or one of its child controls, currently has the input focus. (Inherited from Control.)
Public propertyContextMenuGets or sets the shortcut menu associated with the control. (Inherited from Control.)
Public propertyContextMenuStripGets or sets the ContextMenuStrip associated with this control. (Inherited from Control.)
Public propertyControlsGets the collection of controls contained within the control. (Inherited from Control.)
Public propertyCreatedGets a value indicating whether the control has been created. (Inherited from Control.)
Protected propertyCreateParamsGets the required creation parameters when the control handle is created. (Inherited from Control.)
Public propertyCurrentCellGets or sets the currently active cell.
Public propertyCurrentCellAddressGets the row and column indexes of the currently active cell.
Public propertyCurrentRowGets the row containing the current cell.
Public propertyCursorGets or sets the cursor that is displayed when the mouse pointer is over the control. (Inherited from Control.)
Public propertyDataBindingsGets the data bindings for the control. (Inherited from Control.)
Public propertyDataMemberGets or sets the name of the list or table in the data source for which the DataGridView is displaying data.
Public propertyDataSourceGets or sets the data source that the DataGridView is displaying data for.
Public propertyDefaultCellStyleGets or sets the default cell style to be applied to the cells in the DataGridView if no other cell style properties are set.
Protected propertyDefaultCursorGets or sets the default cursor for the control. (Inherited from Control.)
Protected propertyDefaultImeModeGets the default Input Method Editor (IME) mode supported by the control. (Inherited from Control.)
Protected propertyDefaultMarginGets the space, in pixels, that is specified by default between controls. (Inherited from Control.)
Protected propertyDefaultMaximumSizeGets the length and height, in pixels, that is specified as the default maximum size of a control. (Inherited from Control.)
Protected propertyDefaultMinimumSizeGets the length and height, in pixels, that is specified as the default minimum size of a control. (Inherited from Control.)
Protected propertyDefaultPaddingGets the internal spacing, in pixels, of the contents of a control. (Inherited from Control.)
Protected propertyDefaultSizeGets the default initial size of the control. (Overrides Control.DefaultSize.)
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Public propertyDisplayRectangleGets the rectangle that represents the display area of the control. (Overrides Control.DisplayRectangle.)
Public propertyDisposingGets a value indicating whether the base Control class is in the process of disposing. (Inherited from Control.)
Public propertyDockGets or sets which control borders are docked to its parent control and determines how a control is resized with its parent. (Inherited from Control.)
Protected propertyDoubleBufferedGets or sets a value indicating whether this control should redraw its surface using a secondary buffer to reduce or prevent flicker. (Inherited from Control.)
Public propertyEditingControlGets the control hosted by the current cell, if a cell with an editing control is in edit mode.
Public propertyEditingPanelGets the panel that contains the EditingControl.
Public propertyEditModeGets or sets a value indicating how to begin editing a cell.
Public propertyEnabledGets or sets a value indicating whether the control can respond to user interaction. (Inherited from Control.)
Public propertyEnableHeadersVisualStylesGets or sets a value indicating whether row and column headers use the visual styles of the user's current theme if visual styles are enabled for the application.
Protected propertyEventsGets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public propertyFirstDisplayedCellGets or sets the first cell currently displayed in the DataGridView; typically, this cell is in the upper left corner.
Public propertyFirstDisplayedScrollingColumnHiddenWidthGets the width of the portion of the column that is currently scrolled out of view..
Public propertyFirstDisplayedScrollingColumnIndexGets or sets the index of the column that is the first column displayed on the DataGridView.
Public propertyFirstDisplayedScrollingRowIndexGets or sets the index of the row that is the first row displayed on the DataGridView.
Public propertyFocusedGets a value indicating whether the control has input focus. (Inherited from Control.)
Public propertyFontGets or sets the font of the text displayed by the DataGridView. (Overrides Control.Font.)
Protected propertyFontHeightGets or sets the height of the font of the control. (Inherited from Control.)
Public propertyForeColorGets or sets the foreground color of the DataGridView. (Overrides Control.ForeColor.)
Public propertyGridColorGets or sets the color of the grid lines separating the cells of the DataGridView.
Public propertyHandleGets the window handle that the control is bound to. (Inherited from Control.)
Public propertyHasChildrenGets a value indicating whether the control contains one or more child controls. (Inherited from Control.)
Public propertyHeightGets or sets the height of the control. (Inherited from Control.)
Protected propertyHorizontalScrollBarGets the horizontal scroll bar of the control.
Public propertyHorizontalScrollingOffsetGets or sets the number of pixels by which the control is scrolled horizontally.
Public propertyImeModeGets or sets the Input Method Editor (IME) mode of the control. (Inherited from Control.)
Protected propertyImeModeBaseGets or sets the IME mode of a control. (Inherited from Control.)
Public propertyInvokeRequiredGets a value indicating whether the caller must call an invoke method when making method calls to the control because the caller is on a different thread than the one the control was created on. (Inherited from Control.)
Public propertyIsAccessibleGets or sets a value indicating whether the control is visible to accessibility applications. (Inherited from Control.)
Public propertyIsCurrentCellDirtyGets a value indicating whether the current cell has uncommitted changes.
Public propertyIsCurrentCellInEditModeGets a value indicating whether the currently active cell is being edited.
Public propertyIsCurrentRowDirtyGets a value indicating whether the current row has uncommitted changes.
Public propertyIsDisposedGets a value indicating whether the control has been disposed of. (Inherited from Control.)
Public propertyIsHandleCreatedGets a value indicating whether the control has a handle associated with it. (Inherited from Control.)
Public propertyIsMirroredGets a value indicating whether the control is mirrored. (Inherited from Control.)
Public propertyItem[Int32, Int32]Provides an indexer to get or set the cell located at the intersection of the column and row with the specified indexes.
Public propertyItem[String, Int32]Provides an indexer to get or set the cell located at the intersection of the row with the specified index and the column with the specified name.
Public propertyLayoutEngineGets a cached instance of the control's layout engine. (Inherited from Control.)
Public propertyLeftGets or sets the distance, in pixels, between the left edge of the control and the left edge of its container's client area. (Inherited from Control.)
Public propertyLocationGets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container. (Inherited from Control.)
Public propertyMarginGets or sets the space between controls. (Inherited from Control.)
Public propertyMaximumSizeGets or sets the size that is the upper limit that GetPreferredSize can specify. (Inherited from Control.)
Public propertyMinimumSizeGets or sets the size that is the lower limit that GetPreferredSize can specify. (Inherited from Control.)
Public propertyMultiSelectGets or sets a value indicating whether the user is allowed to select more than one cell, row, or column of the DataGridView at a time.
Public propertyNameGets or sets the name of the control. (Inherited from Control.)
Public propertyNewRowIndexGets the index of the row for new records.
Public propertyPaddingInfrastructure. This property is not relevant for this control.
Public propertyParentGets or sets the parent container of the control. (Inherited from Control.)
Public propertyPreferredSizeGets the size of a rectangular area into which the control can fit. (Inherited from Control.)
Public propertyProductNameGets the product name of the assembly containing the control. (Inherited from Control.)
Public propertyProductVersionGets the version of the assembly containing the control. (Inherited from Control.)
Public propertyReadOnlyGets or sets a value indicating whether the user can edit the cells of the DataGridView control.
Public propertyRecreatingHandleGets a value indicating whether the control is currently re-creating its handle. (Inherited from Control.)
Public propertyRegionGets or sets the window region associated with the control. (Inherited from Control.)
Protected propertyRenderRightToLeft Obsolete. This property is now obsolete. (Inherited from Control.)
Protected propertyResizeRedrawGets or sets a value indicating whether the control redraws itself when resized. (Inherited from Control.)
Public propertyRightGets the distance, in pixels, between the right edge of the control and the left edge of its container's client area. (Inherited from Control.)
Public propertyRightToLeftGets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts. (Inherited from Control.)
Public propertyRowCountGets or sets the number of rows displayed in the DataGridView.
Public propertyRowHeadersBorderStyleGets or sets the border style of the row header cells.
Public propertyRowHeadersDefaultCellStyleGets or sets the default style applied to the row header cells.
Public propertyRowHeadersVisibleGets or sets a value indicating whether the column that contains row headers is displayed.
Public propertyRowHeadersWidthGets or sets the width, in pixels, of the column that contains the row headers.
Public propertyRowHeadersWidthSizeModeGets or sets a value indicating whether the width of the row headers is adjustable and whether it can be adjusted by the user or is automatically adjusted to fit the contents of the headers.
Public propertyRowsGets a collection that contains all the rows in the DataGridView control.
Public propertyRowsDefaultCellStyleGets or sets the default style applied to the row cells of the DataGridView.
Public propertyRowTemplateGets or sets the row that represents the template for all the rows in the control.
Protected propertyScaleChildrenGets a value that determines the scaling of child controls. (Inherited from Control.)
Public propertyScrollBarsGets or sets the type of scroll bars to display for the DataGridView control.
Public propertySelectedCellsGets the collection of cells selected by the user.
Public propertySelectedColumnsGets the collection of columns selected by the user.
Public propertySelectedRowsGets the collection of rows selected by the user.
Public propertySelectionModeGets or sets a value indicating how the cells of the DataGridView can be selected.
Public propertyShowCellErrorsGets or sets a value indicating whether to show cell errors.
Public propertyShowCellToolTipsGets or sets a value indicating whether or not ToolTips will show when the mouse pointer pauses on a cell.
Public propertyShowEditingIconGets or sets a value indicating whether or not the editing glyph is visible in the row header of the cell being edited.
Protected propertyShowFocusCuesGets a value indicating whether the control should display focus rectangles. (Inherited from Control.)
Protected propertyShowKeyboardCuesGets a value indicating whether the user interface is in the appropriate state to show or hide keyboard accelerators. (Inherited from Control.)
Public propertyShowRowErrorsGets or sets a value indicating whether row headers will display error glyphs for each row that contains a data entry error.
Public propertySiteGets or sets the site of the control. (Inherited from Control.)
Public propertySizeGets or sets the height and width of the control. (Inherited from Control.)
Public propertySortedColumnGets the column by which the DataGridView contents are currently sorted.
Public propertySortOrderGets a value indicating whether the items in the DataGridView control are sorted in ascending or descending order, or are not sorted.
Public propertyStandardTabGets or sets a value indicating whether the TAB key moves the focus to the next control in the tab order rather than moving focus to the next cell in the control.
Public propertyTabIndexGets or sets the tab order of the control within its container. (Inherited from Control.)
Public propertyTabStopGets or sets a value indicating whether the user can give the focus to this control using the TAB key. (Inherited from Control.)
Public propertyTagGets or sets the object that contains data about the control. (Inherited from Control.)
Public propertyTextInfrastructure. Gets or sets the text associated with the control. (Overrides Control.Text.)
Public propertyTopGets or sets the distance, in pixels, between the top edge of the control and the top edge of its container's client area. (Inherited from Control.)
Public propertyTopLeftHeaderCellGets or sets the header cell located in the upper left corner of the DataGridView control.
Public propertyTopLevelControlGets the parent control that is not parented by another Windows Forms control. Typically, this is the outermost Form that the control is contained in. (Inherited from Control.)
Public propertyUserSetCursorGets the default or user-specified value of the Cursor property.
Public propertyUseWaitCursorGets or sets a value indicating whether to use the wait cursor for the current control and all child controls. (Inherited from Control.)
Protected propertyVerticalScrollBarGets the vertical scroll bar of the control.
Public propertyVerticalScrollingOffsetGets the number of pixels by which the control is scrolled vertically.
Public propertyVirtualModeGets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
Public propertyVisibleGets or sets a value indicating whether the control and all its child controls are displayed. (Inherited from Control.)
Public propertyWidthGets or sets the width of the control. (Inherited from Control.)
Public propertyWindowTargetInfrastructure. This property is not relevant for this class. (Inherited from Control.)
Top

  NameDescription
Protected methodAccessibilityNotifyClients(AccessibleEvents, Int32)Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control. (Inherited from Control.)
Protected methodAccessibilityNotifyClients(AccessibleEvents, Int32, Int32)Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control . (Inherited from Control.)
Protected methodAccessibilityNotifyCurrentCellChangedNotifies the accessible client applications when a new cell becomes the current cell.
Public methodAdjustColumnHeaderBorderStyleAdjusts the DataGridViewAdvancedBorderStyle for a column header cell of a DataGridView that is currently being painted.
Public methodAreAllCellsSelectedReturns a value indicating whether all the DataGridView cells are currently selected.
Public methodAutoResizeColumn(Int32)Adjusts the width of the specified column to fit the contents of all its cells, including the header cell.
Public methodAutoResizeColumn(Int32, DataGridViewAutoSizeColumnMode)Adjusts the width of the specified column using the specified size mode.
Protected methodAutoResizeColumn(Int32, DataGridViewAutoSizeColumnMode, Boolean)Adjusts the width of the specified column using the specified size mode, optionally calculating the width with the expectation that row heights will subsequently be adjusted.
Public methodAutoResizeColumnHeadersHeight()Adjusts the height of the column headers to fit the contents of the largest column header.
Public methodAutoResizeColumnHeadersHeight(Int32)Adjusts the height of the column headers based on changes to the contents of the header in the specified column.
Protected methodAutoResizeColumnHeadersHeight(Boolean, Boolean)Adjusts the height of the column headers to fit their contents, optionally calculating the height with the expectation that the column and/or row header widths will subsequently be adjusted.
Protected methodAutoResizeColumnHeadersHeight(Int32, Boolean, Boolean)Adjusts the height of the column headers based on changes to the contents of the header in the specified column, optionally calculating the height with the expectation that the column and/or row header widths will subsequently be adjusted.
Public methodAutoResizeColumns()Adjusts the width of all columns to fit the contents of all their cells, including the header cells.
Public methodAutoResizeColumns(DataGridViewAutoSizeColumnsMode)Adjusts the width of all columns using the specified size mode.
Protected methodAutoResizeColumns(DataGridViewAutoSizeColumnsMode, Boolean)Adjusts the width of all columns using the specified size mode, optionally calculating the widths with the expectation that row heights will subsequently be adjusted.
Public methodAutoResizeRow(Int32)Adjusts the height of the specified row to fit the contents of all its cells including the header cell.
Public methodAutoResizeRow(Int32, DataGridViewAutoSizeRowMode)Adjusts the height of the specified row using the specified size mode.
Protected methodAutoResizeRow(Int32, DataGridViewAutoSizeRowMode, Boolean)Adjusts the height of the specified row using the specified size mode, optionally calculating the height with the expectation that column widths will subsequently be adjusted.
Public methodAutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode)Adjusts the width of the row headers using the specified size mode.
Public methodAutoResizeRowHeadersWidth(Int32, DataGridViewRowHeadersWidthSizeMode)Adjusts the width of the row headers based on changes to the contents of the header in the specified row and using the specified size mode.
Protected methodAutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode, Boolean, Boolean)Adjusts the width of the row headers using the specified size mode, optionally calculating the width with the expectation that the row and/or column header widths will subsequently be adjusted.
Protected methodAutoResizeRowHeadersWidth(Int32, DataGridViewRowHeadersWidthSizeMode, Boolean, Boolean)Adjusts the width of the row headers based on changes to the contents of the header in the specified row and using the specified size mode, optionally calculating the width with the expectation that the row and/or column header widths will subsequently be adjusted.
Public methodAutoResizeRows()Adjusts the heights of all rows to fit the contents of all their cells, including the header cells.
Public methodAutoResizeRows(DataGridViewAutoSizeRowsMode)Adjusts the heights of the rows using the specified size mode value.
Protected methodAutoResizeRows(DataGridViewAutoSizeRowsMode, Boolean)Adjusts the heights of all rows using the specified size mode, optionally calculating the heights with the expectation that column widths will subsequently be adjusted.
Protected methodAutoResizeRows(Int32, Int32, DataGridViewAutoSizeRowMode, Boolean)Adjusts the heights of the specified rows using the specified size mode, optionally calculating the heights with the expectation that column widths will subsequently be adjusted.
Public methodBeginEditPuts the current cell in edit mode.
Public methodBeginInvoke(Delegate)Executes the specified delegate asynchronously on the thread that the control's underlying handle was created on. (Inherited from Control.)
Public methodBeginInvoke(Delegate, Object[])Executes the specified delegate asynchronously with the specified arguments, on the thread that the control's underlying handle was created on. (Inherited from Control.)
Public methodBringToFrontBrings the control to the front of the z-order. (Inherited from Control.)
Public methodCancelEditCancels edit mode for the currently selected cell and discards any changes.
Public methodClearSelection()Clears the current selection by unselecting all selected cells.
Protected methodClearSelection(Int32, Int32, Boolean)Cancels the selection of all currently selected cells except the one indicated, optionally ensuring that the indicated cell is selected.
Public methodCommitEditCommits changes in the current cell to the data cache without ending edit mode.
Public methodContainsRetrieves a value indicating whether the specified control is a child of the control. (Inherited from Control.)
Protected methodCreateAccessibilityInstanceCreates a new accessible object for the DataGridView. (Overrides Control.CreateAccessibilityInstance().)
Protected methodCreateColumnsInstanceCreates and returns a new DataGridViewColumnCollection.
Public methodCreateControlForces the creation of the visible control, including the creation of the handle and any visible child controls. (Inherited from Control.)
Protected methodCreateControlsInstanceCreates and returns a new Control.ControlCollection that can be cast to type DataGridView.DataGridViewControlCollection. (Overrides Control.CreateControlsInstance().)
Public methodCreateGraphicsCreates the Graphics for the control. (Inherited from Control.)
Protected methodCreateHandleCreates a handle for the control. (Inherited from Control.)
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.)
Protected methodCreateRowsInstanceCreates and returns a new DataGridViewRowCollection.
Protected methodDefWndProcSends the specified message to the default window procedure. (Inherited from Control.)
Protected methodDestroyHandleDestroys the handle associated with the control. (Inherited from Control.)
Public methodDisplayedColumnCountReturns the number of columns displayed to the user.
Public methodDisplayedRowCountReturns the number of rows displayed to the user.
Public methodDispose()Releases all resources used by the Component. (Inherited from Component.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources. (Overrides Control.Dispose(Boolean).)
Public methodDoDragDropBegins a drag-and-drop operation. (Inherited from Control.)
Public methodDrawToBitmapSupports rendering to the specified bitmap. (Inherited from Control.)
Public methodEndEdit()Commits and ends the edit operation on the current cell using the default error context.
Public methodEndEdit(DataGridViewDataErrorContexts)Commits and ends the edit operation on the current cell using the specified error context.
Public methodEndInvokeRetrieves the return value of the asynchronous operation represented by the IAsyncResult passed. (Inherited from Control.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public methodFindFormRetrieves the form that the control is on. (Inherited from Control.)
Public methodFocusSets input focus to the control. (Inherited from Control.)
Protected methodGetAccessibilityObjectByIdRetrieves the specified AccessibleObject. (Overrides Control.GetAccessibilityObjectById(Int32).)
Protected methodGetAutoSizeModeRetrieves a value indicating how a control will behave when its AutoSize property is enabled. (Inherited from Control.)
Public methodGetCellCountGets the number of cells that satisfy the provided filter.
Public methodGetCellDisplayRectangleReturns the rectangle that represents the display area for a cell.
Public methodGetChildAtPoint(Point)Retrieves the child control that is located at the specified coordinates. (Inherited from Control.)
Public methodGetChildAtPoint(Point, GetChildAtPointSkip)Retrieves the child control that is located at the specified coordinates, specifying whether to ignore child controls of a certain type. (Inherited from Control.)
Public methodGetClipboardContentRetrieves the formatted values that represent the contents of the selected cells for copying to the Clipboard.
Public methodGetColumnDisplayRectangleReturns the rectangle that represents the display area for a column, as determined by the column index.
Public methodGetContainerControlReturns the next ContainerControl up the control's chain of parent controls. (Inherited from Control.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetNextControlRetrieves the next control forward or back in the tab order of child controls. (Inherited from Control.)
Public methodGetPreferredSizeRetrieves the size of a rectangular area into which a control can be fitted. (Inherited from Control.)
Public methodGetRowDisplayRectangleReturns the rectangle that represents the display area for a row, as determined by the row index.
Protected methodGetScaledBoundsRetrieves the bounds within which the control is scaled. (Inherited from Control.)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Protected methodGetStyleRetrieves the value of the specified control style bit for the control. (Inherited from Control.)
Protected methodGetTopLevelDetermines if the control is a top-level control. (Inherited from Control.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodHideConceals the control from the user. (Inherited from Control.)
Public methodHitTestReturns location information, such as row and column indices, given x- and y-coordinates.
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodInitLayoutCalled after the control has been added to another container. (Inherited from Control.)
Public methodInvalidate()Invalidates the entire surface of the control and causes the control to be redrawn. (Inherited from Control.)
Public methodInvalidate(Boolean)Invalidates a specific region of the control and causes a paint message to be sent to the control. Optionally, invalidates the child controls assigned to the control. (Inherited from Control.)
Public methodInvalidate(Rectangle)Invalidates the specified region of the control (adds it to the control's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control. (Inherited from Control.)
Public methodInvalidate(Region)Invalidates the specified region of the control (adds it to the control's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control. (Inherited from Control.)
Public methodInvalidate(Rectangle, Boolean)Invalidates the specified region of the control (adds it to the control's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control. Optionally, invalidates the child controls assigned to the control. (Inherited from Control.)
Public methodInvalidate(Region, Boolean)Invalidates the specified region of the control (adds it to the control's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control. Optionally, invalidates the child controls assigned to the control. (Inherited from Control.)
Public methodInvalidateCell(DataGridViewCell)Invalidates the specified cell of the DataGridView, forcing it to be repainted.
Public methodInvalidateCell(Int32, Int32)Invalidates the cell with the specified row and column indexes, forcing it to be repainted.
Public methodInvalidateColumnInvalidates the specified column of the DataGridView, forcing it to be repainted.
Public methodInvalidateRowInvalidates the specified row of the DataGridView, forcing it to be repainted.
Public methodInvoke(Delegate)Executes the specified delegate on the thread that owns the control's underlying window handle. (Inherited from Control.)
Public methodInvoke(Delegate, Object[])Executes the specified delegate, on the thread that owns the control's underlying window handle, with the specified list of arguments. (Inherited from Control.)
Protected methodInvokeGotFocusRaises the GotFocus event for the specified control. (Inherited from Control.)
Protected methodInvokeLostFocusRaises the LostFocus event for the specified control. (Inherited from Control.)
Protected methodInvokeOnClickRaises the Click event for the specified control. (Inherited from Control.)
Protected methodInvokePaintRaises the Paint event for the specified control. (Inherited from Control.)
Protected methodInvokePaintBackgroundRaises the PaintBackground event for the specified control. (Inherited from Control.)
Protected methodIsInputCharDetermines whether a character is an input character that the DataGridView recognizes. (Overrides Control.IsInputChar(Char).)
Protected methodIsInputKeyDetermines whether the specified key is a regular input key or a special key that requires preprocessing. (Overrides Control.IsInputKey(Keys).)
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 methodNotifyCurrentCellDirtyNotifies the DataGridView that the current cell has uncommitted changes.
Protected methodNotifyInvalidateInfrastructure. Raises the Invalidated event with a specified region of the control to invalidate. (Inherited from Control.)
Protected methodOnAllowUserToAddRowsChangedRaises the AllowUserToAddRowsChanged event.
Protected methodOnAllowUserToDeleteRowsChangedRaises the AllowUserToDeleteRowsChanged event.
Protected methodOnAllowUserToOrderColumnsChangedRaises the AllowUserToOrderColumnsChanged event.
Protected methodOnAllowUserToResizeColumnsChangedRaises the AllowUserToResizeColumnsChanged event.
Protected methodOnAllowUserToResizeRowsChangedRaises the AllowUserToResizeRowsChanged event.
Protected methodOnAlternatingRowsDefaultCellStyleChangedRaises the AlternatingRowsDefaultCellStyleChanged event.
Protected methodOnAutoGenerateColumnsChangedRaises the AutoGenerateColumnsChanged event.
Protected methodOnAutoSizeChangedRaises the AutoSizeChanged event. (Inherited from Control.)
Protected methodOnAutoSizeColumnModeChangedRaises the AutoSizeColumnModeChanged event.
Protected methodOnAutoSizeColumnsModeChangedRaises the AutoSizeColumnsModeChanged event.
Protected methodOnAutoSizeRowsModeChangedRaises the AutoSizeRowsModeChanged event.
Protected methodOnBackColorChangedRaises the BackColorChanged event. (Inherited from Control.)
Protected methodOnBackgroundColorChangedRaises the BackgroundColorChanged event.
Protected methodOnBackgroundImageChangedRaises the BackgroundImageChanged event. (Inherited from Control.)
Protected methodOnBackgroundImageLayoutChangedRaises the BackgroundImageLayoutChanged event. (Inherited from Control.)
Protected methodOnBindingContextChangedRaises the BindingContextChanged event. (Overrides Control.OnBindingContextChanged(EventArgs).)
Protected methodOnBorderStyleChangedRaises the BorderStyleChanged event.
Protected methodOnCancelRowEditRaises the CancelRowEdit event.
Protected methodOnCausesValidationChangedRaises the CausesValidationChanged event. (Inherited from Control.)
Protected methodOnCellBeginEditRaises the CellBeginEdit event.
Protected methodOnCellBorderStyleChangedRaises the CellBorderStyleChanged event.
Protected methodOnCellClickRaises the CellClick event.
Protected methodOnCellContentClickRaises the CellContentClick event.
Protected methodOnCellContentDoubleClickRaises the CellContentDoubleClick event.
Protected methodOnCellContextMenuStripChangedRaises the CellContextMenuStripChanged event.
Protected methodOnCellContextMenuStripNeededRaises the CellContextMenuStripNeeded event.
Protected methodOnCellDoubleClickRaises the CellDoubleClick event.
Protected methodOnCellEndEditRaises the CellEndEdit event.
Protected methodOnCellEnterRaises the CellEnter event.
Protected methodOnCellErrorTextChangedRaises the CellErrorTextChanged event.
Protected methodOnCellErrorTextNeededRaises the CellErrorTextNeeded event.
Protected methodOnCellFormattingRaises the CellFormatting event.
Protected methodOnCellLeaveRaises the CellLeave event.
Protected methodOnCellMouseClickRaises the CellMouseClick event.
Protected methodOnCellMouseDoubleClickRaises the CellMouseDoubleClick event.
Protected methodOnCellMouseDownRaises the CellMouseDown event.
Protected methodOnCellMouseEnterRaises the CellMouseEnter event.
Protected methodOnCellMouseLeaveRaises the CellMouseLeave event.
Protected methodOnCellMouseMoveRaises the CellMouseMove event.
Protected methodOnCellMouseUpRaises the CellMouseUp event.
Protected methodOnCellPaintingRaises the CellPainting event.
Protected methodOnCellParsingRaises the CellParsing event.
Protected methodOnCellStateChangedRaises the CellStateChanged event.
Protected methodOnCellStyleChangedRaises the CellStyleChanged event.
Protected methodOnCellStyleContentChangedRaises the CellStyleContentChanged event.
Protected methodOnCellToolTipTextChangedRaises the CellToolTipTextChanged event.
Protected methodOnCellToolTipTextNeededRaises the CellToolTipTextNeeded event.
Protected methodOnCellValidatedRaises the CellValidated event.
Protected methodOnCellValidatingRaises the CellValidating event.
Protected methodOnCellValueChangedRaises the CellValueChanged event.
Protected methodOnCellValueNeededRaises the CellValueNeeded event.
Protected methodOnCellValuePushedRaises the CellValuePushed event.
Protected methodOnChangeUICuesRaises the ChangeUICues event. (Inherited from Control.)
Protected methodOnClickRaises the Click event. (Inherited from Control.)
Protected methodOnClientSizeChangedRaises the ClientSizeChanged event. (Inherited from Control.)
Protected methodOnColumnAddedRaises the ColumnAdded event.
Protected methodOnColumnContextMenuStripChangedRaises the ColumnContextMenuStripChanged event.
Protected methodOnColumnDataPropertyNameChangedRaises the ColumnDataPropertyNameChanged event.
Protected methodOnColumnDefaultCellStyleChangedRaises the ColumnDefaultCellStyleChanged event.
Protected methodOnColumnDisplayIndexChangedRaises the ColumnDisplayIndexChanged event.
Protected methodOnColumnDividerDoubleClickRaises the ColumnDividerDoubleClick event.
Protected methodOnColumnDividerWidthChangedRaises the ColumnDividerWidthChanged event.
Protected methodOnColumnHeaderCellChangedRaises the ColumnHeaderCellChanged event.
Protected methodOnColumnHeaderMouseClickRaises the ColumnHeaderMouseClick event.
Protected methodOnColumnHeaderMouseDoubleClickRaises the ColumnHeaderMouseDoubleClick event.
Protected methodOnColumnHeadersBorderStyleChangedRaises the ColumnHeadersBorderStyleChanged event.
Protected methodOnColumnHeadersDefaultCellStyleChangedRaises the ColumnHeadersDefaultCellStyleChanged event.
Protected methodOnColumnHeadersHeightChangedRaises the ColumnHeadersHeightChanged event.
Protected methodOnColumnHeadersHeightSizeModeChangedRaises the ColumnHeadersHeightSizeModeChanged event.
Protected methodOnColumnMinimumWidthChangedRaises the ColumnMinimumWidthChanged event.
Protected methodOnColumnNameChangedRaises the ColumnNameChanged event.
Protected methodOnColumnRemovedRaises the ColumnRemoved event.
Protected methodOnColumnSortModeChangedRaises the ColumnSortModeChanged event.
Protected methodOnColumnStateChangedRaises the ColumnStateChanged event.
Protected methodOnColumnToolTipTextChangedRaises the ColumnToolTipTextChanged event.
Protected methodOnColumnWidthChangedRaises the ColumnWidthChanged event.
Protected methodOnContextMenuChangedRaises the ContextMenuChanged event. (Inherited from Control.)
Protected methodOnContextMenuStripChangedRaises the ContextMenuStripChanged event. (Inherited from Control.)
Protected methodOnControlAddedRaises the ControlAdded event. (Inherited from Control.)
Protected methodOnControlRemovedRaises the ControlRemoved event. (Inherited from Control.)
Protected methodOnCreateControlRaises the CreateControl method. (Inherited from Control.)
Protected methodOnCurrentCellChangedRaises the CurrentCellChanged event.
Protected methodOnCurrentCellDirtyStateChangedRaises the CurrentCellDirtyStateChanged event.
Protected methodOnCursorChangedRaises the CursorChanged event and updates the UserSetCursor property if the cursor was changed in user code. (Overrides Control.OnCursorChanged(EventArgs).)
Protected methodOnDataBindingCompleteRaises the DataBindingComplete event.
Protected methodOnDataErrorRaises the DataError event.
Protected methodOnDataMemberChangedRaises the DataMemberChanged event.
Protected methodOnDataSourceChangedRaises the DataSourceChanged event.
Protected methodOnDefaultCellStyleChangedRaises the DefaultCellStyleChanged event.
Protected methodOnDefaultValuesNeededRaises the DefaultValuesNeeded event.
Protected methodOnDockChangedRaises the DockChanged event. (Inherited from Control.)
Protected methodOnDoubleClickRaises the DoubleClick event. (Overrides Control.OnDoubleClick(EventArgs).)
Protected methodOnDragDropRaises the DragDrop event. (Inherited from Control.)
Protected methodOnDragEnterRaises the DragEnter event. (Inherited from Control.)
Protected methodOnDragLeaveRaises the DragLeave event. (Inherited from Control.)
Protected methodOnDragOverRaises the DragOver event. (Inherited from Control.)
Protected methodOnEditingControlShowingRaises the EditingControlShowing event.
Protected methodOnEditModeChangedRaises the EditModeChanged event.
Protected methodOnEnabledChangedRaises the EnabledChanged event. (Overrides Control.OnEnabledChanged(EventArgs).)
Protected methodOnEnterRaises the Enter event. (Overrides Control.OnEnter(EventArgs).)
Protected methodOnFontChangedRaises the FontChanged event. (Overrides Control.OnFontChanged(EventArgs).)
Protected methodOnForeColorChangedRaises the ForeColorChanged event. (Overrides Control.OnForeColorChanged(EventArgs).)
Protected methodOnGiveFeedbackRaises the GiveFeedback event. (Inherited from Control.)
Protected methodOnGotFocusRaises the GotFocus event. (Overrides Control.OnGotFocus(EventArgs).)
Protected methodOnGridColorChangedRaises the GridColorChanged event.
Protected methodOnHandleCreatedRaises the HandleCreated event. (Overrides Control.OnHandleCreated(EventArgs).)
Protected methodOnHandleDestroyedRaises the HandleDestroyed event. (Overrides Control.OnHandleDestroyed(EventArgs).)
Protected methodOnHelpRequestedRaises the HelpRequested event. (Inherited from Control.)
Protected methodOnImeModeChangedRaises the ImeModeChanged event. (Inherited from Control.)
Protected methodOnInvalidatedRaises the Invalidated event. (Inherited from Control.)
Protected methodOnKeyDownRaises the KeyDown event. (Overrides Control.OnKeyDown(KeyEventArgs).)
Protected methodOnKeyPressRaises the KeyPress event. (Overrides Control.OnKeyPress(KeyPressEventArgs).)
Protected methodOnKeyUpRaises the KeyUp event. (Overrides Control.OnKeyUp(KeyEventArgs).)
Protected methodOnLayoutRaises the Layout event. (Overrides Control.OnLayout(LayoutEventArgs).)
Protected methodOnLeaveRaises the Leave event. (Overrides Control.OnLeave(EventArgs).)
Protected methodOnLocationChangedRaises the LocationChanged event. (Inherited from Control.)
Protected methodOnLostFocusRaises the LostFocus event. (Overrides Control.OnLostFocus(EventArgs).)
Protected methodOnMarginChangedRaises the MarginChanged event. (Inherited from Control.)
Protected methodOnMouseCaptureChangedRaises the MouseCaptureChanged event. (Inherited from Control.)
Protected methodOnMouseClickRaises the MouseClick event. (Overrides Control.OnMouseClick(MouseEventArgs).)
Protected methodOnMouseDoubleClickRaises the MouseDoubleClick event. (Overrides Control.OnMouseDoubleClick(MouseEventArgs).)
Protected methodOnMouseDownRaises the MouseDown event. (Overrides Control.OnMouseDown(MouseEventArgs).)
Protected methodOnMouseEnterRaises the MouseEnter event. (Overrides Control.OnMouseEnter(EventArgs).)
Protected methodOnMouseHoverRaises the MouseHover event. (Inherited from Control.)
Protected methodOnMouseLeaveRaises the MouseLeave event. (Overrides Control.OnMouseLeave(EventArgs).)
Protected methodOnMouseMoveRaises the MouseMove event. (Overrides Control.OnMouseMove(MouseEventArgs).)
Protected methodOnMouseUpRaises the MouseUp event. (Overrides Control.OnMouseUp(MouseEventArgs).)
Protected methodOnMouseWheelRaises the MouseWheel event. (Overrides Control.OnMouseWheel(MouseEventArgs).)
Protected methodOnMoveRaises the Move event. (Inherited from Control.)
Protected methodOnMultiSelectChangedRaises the MultiSelectChanged event.
Protected methodOnNewRowNeededRaises the NewRowNeeded event.
Protected methodOnNotifyMessageNotifies the control of Windows messages. (Inherited from Control.)
Protected methodOnPaddingChangedRaises the PaddingChanged event. (Inherited from Control.)
Protected methodOnPaintRaises the Paint event. (Overrides Control.OnPaint(PaintEventArgs).)
Protected methodOnPaintBackgroundPaints the background of the control. (Inherited from Control.)
Protected methodOnParentBackColorChangedRaises the BackColorChanged event when the BackColor property value of the control's container changes. (Inherited from Control.)
Protected methodOnParentBackgroundImageChangedRaises the BackgroundImageChanged event when the BackgroundImage property value of the control's container changes. (Inherited from Control.)
Protected methodOnParentBindingContextChangedRaises the BindingContextChanged event when the BindingContext property value of the control's container changes. (Inherited from Control.)
Protected methodOnParentChangedRaises the ParentChanged event. (Inherited from Control.)
Protected methodOnParentCursorChangedRaises the CursorChanged event. (Inherited from Control.)
Protected methodOnParentEnabledChangedRaises the EnabledChanged event when the Enabled property value of the control's container changes. (Inherited from Control.)
Protected methodOnParentFontChangedRaises the FontChanged event when the Font property value of the control's container changes. (Inherited from Control.)
Protected methodOnParentForeColorChangedRaises the ForeColorChanged event when the ForeColor property value of the control's container changes. (Inherited from Control.)
Protected methodOnParentRightToLeftChangedRaises the RightToLeftChanged event when the RightToLeft property value of the control's container changes. (Inherited from Control.)
Protected methodOnParentVisibleChangedRaises the VisibleChanged event when the Visible property value of the control's container changes. (Inherited from Control.)
Protected methodOnPreviewKeyDownRaises the PreviewKeyDown event. (Inherited from Control.)
Protected methodOnPrintRaises the Paint event. (Inherited from Control.)
Protected methodOnQueryContinueDragRaises the QueryContinueDrag event. (Inherited from Control.)
Protected methodOnReadOnlyChangedRaises the ReadOnlyChanged event.
Protected methodOnRegionChangedRaises the RegionChanged event. (Inherited from Control.)
Protected methodOnResizeRaises the Resize event. (Overrides Control.OnResize(EventArgs).)
Protected methodOnRightToLeftChangedRaises the RightToLeftChanged event. (Overrides Control.OnRightToLeftChanged(EventArgs).)
Protected methodOnRowContextMenuStripChangedRaises the RowContextMenuStripChanged event.
Protected methodOnRowContextMenuStripNeededRaises the RowContextMenuStripNeeded event.
Protected methodOnRowDefaultCellStyleChangedRaises the RowDefaultCellStyleChanged event.
Protected methodOnRowDirtyStateNeededRaises the RowDirtyStateNeeded event.
Protected methodOnRowDividerDoubleClickRaises the RowDividerDoubleClick event.
Protected methodOnRowDividerHeightChangedRaises the RowDividerHeightChanged event.
Protected methodOnRowEnterRaises the RowEnter event.
Protected methodOnRowErrorTextChangedRaises the RowErrorTextChanged event.
Protected methodOnRowErrorTextNeededRaises the RowErrorTextNeeded event.
Protected methodOnRowHeaderCellChangedRaises the RowHeaderCellChanged event.
Protected methodOnRowHeaderMouseClickRaises the RowHeaderMouseClick event.
Protected methodOnRowHeaderMouseDoubleClickRaises the RowHeaderMouseDoubleClick event.
Protected methodOnRowHeadersBorderStyleChangedRaises the RowHeadersBorderStyleChanged event.
Protected methodOnRowHeadersDefaultCellStyleChangedRaises the RowHeadersDefaultCellStyleChanged event.
Protected methodOnRowHeadersWidthChangedRaises the RowHeadersWidthChanged event.
Protected methodOnRowHeadersWidthSizeModeChangedRaises the RowHeadersWidthSizeModeChanged event.
Protected methodOnRowHeightChangedRaises the RowHeightChanged event.
Protected methodOnRowHeightInfoNeededRaises the RowHeightInfoNeeded event.
Protected methodOnRowHeightInfoPushedRaises the RowHeightInfoPushed event.
Protected methodOnRowLeaveRaises the RowLeave event.
Protected methodOnRowMinimumHeightChangedRaises the RowMinimumHeightChanged event.
Protected methodOnRowPostPaintRaises the RowPostPaint event.
Protected methodOnRowPrePaintRaises the RowPrePaint event.
Protected methodOnRowsAddedRaises the RowsAdded event.
Protected methodOnRowsDefaultCellStyleChangedRaises the RowsDefaultCellStyleChanged event.
Protected methodOnRowsRemovedRaises the RowsRemoved event.
Protected methodOnRowStateChangedRaises the RowStateChanged event.
Protected methodOnRowUnsharedRaises the RowUnshared event.
Protected methodOnRowValidatedRaises the RowValidated event.
Protected methodOnRowValidatingRaises the RowValidating event.
Protected methodOnScrollRaises the Scroll event.
Protected methodOnSelectionChangedRaises the SelectionChanged event.
Protected methodOnSizeChangedRaises the SizeChanged event. (Inherited from Control.)
Protected methodOnSortCompareRaises the SortCompare event.
Protected methodOnSortedRaises the Sorted event.
Protected methodOnStyleChangedRaises the StyleChanged event. (Inherited from Control.)
Protected methodOnSystemColorsChangedRaises the SystemColorsChanged event. (Inherited from Control.)
Protected methodOnTabIndexChangedRaises the TabIndexChanged event. (Inherited from Control.)
Protected methodOnTabStopChangedRaises the TabStopChanged event. (Inherited from Control.)
Protected methodOnTextChangedRaises the TextChanged event. (Inherited from Control.)
Protected methodOnUserAddedRowRaises the UserAddedRow event.
Protected methodOnUserDeletedRowRaises the UserDeletedRow event.
Protected methodOnUserDeletingRowRaises the UserDeletingRow event.
Protected methodOnValidatedRaises the Validated event. (Inherited from Control.)
Protected methodOnValidatingRaises the Validating event. (Overrides Control.OnValidating(CancelEventArgs).)
Protected methodOnVisibleChangedRaises the VisibleChanged event. (Overrides Control.OnVisibleChanged(EventArgs).)
Protected methodPaintBackgroundPaints the background of the DataGridView.
Public methodPerformLayout()Forces the control to apply layout logic to all its child controls. (Inherited from Control.)
Public methodPerformLayout(Control, String)Forces the control to apply layout logic to all its child controls. (Inherited from Control.)
Public methodPointToClientComputes the location of the specified screen point into client coordinates. (Inherited from Control.)
Public methodPointToScreenComputes the location of the specified client point into screen coordinates. (Inherited from Control.)
Public methodPreProcessControlMessagePreprocesses keyboard or input messages within the message loop before they are dispatched. (Inherited from Control.)
Public methodPreProcessMessagePreprocesses keyboard or input messages within the message loop before they are dispatched. (Inherited from Control.)
Protected methodProcessAKeyProcesses the A key.
Protected methodProcessCmdKeyProcesses a command key. (Inherited from Control.)
Protected methodProcessDataGridViewKeyProcesses keys used for navigating in the DataGridView.
Protected methodProcessDeleteKeyProcesses the DELETE key.
Protected methodProcessDialogCharProcesses a dialog character. (Inherited from Control.)
Protected methodProcessDialogKeyProcesses keys, such as the TAB, ESCAPE, ENTER, and ARROW keys, used to control dialog boxes. (Overrides Control.ProcessDialogKey(Keys).)
Protected methodProcessDownKeyProcesses the DOWN ARROW key.
Protected methodProcessEndKeyProcesses the END key.
Protected methodProcessEnterKeyProcesses the ENTER key.
Protected methodProcessEscapeKeyProcesses the ESC key.
Protected methodProcessF2KeyProcesses the F2 key.
Protected methodProcessHomeKeyProcesses the HOME key.
Protected methodProcessInsertKeyProcesses the INSERT key.
Protected methodProcessKeyEventArgsProcesses a key message and generates the appropriate control events. (Overrides Control.ProcessKeyEventArgs(Message).)
Protected methodProcessKeyMessageProcesses a keyboard message. (Inherited from Control.)
Protected methodProcessKeyPreviewPreviews a keyboard message. (Overrides Control.ProcessKeyPreview(Message).)
Protected methodProcessLeftKeyProcesses the LEFT ARROW key.
Protected methodProcessMnemonicProcesses a mnemonic character. (Inherited from Control.)
Protected methodProcessNextKeyProcesses the PAGE DOWN key.
Protected methodProcessPriorKeyProcesses the PAGE UP key.
Protected methodProcessRightKeyProcesses the RIGHT ARROW key.
Protected methodProcessSpaceKeyProcesses the SPACEBAR.
Protected methodProcessTabKeyProcesses the TAB key.
Protected methodProcessUpKeyProcesses the UP ARROW key.
Protected methodProcessZeroKeyProcesses the 0 key.
Protected methodRaiseDragEventInfrastructure. Raises the appropriate drag event. (Inherited from Control.)
Protected methodRaiseKeyEventInfrastructure. Raises the appropriate key event. (Inherited from Control.)
Protected methodRaiseMouseEventInfrastructure. Raises the appropriate mouse event. (Inherited from Control.)
Protected methodRaisePaintEventInfrastructure. Raises the appropriate paint event. (Inherited from Control.)
Protected methodRecreateHandleForces the re-creation of the handle for the control. (Inherited from Control.)
Public methodRectangleToClientComputes the size and location of the specified screen rectangle in client coordinates. (Inherited from Control.)
Public methodRectangleToScreenComputes the size and location of the specified client rectangle in screen coordinates. (Inherited from Control.)
Public methodRefreshForces the control to invalidate its client area and immediately redraw itself and any child controls. (Inherited from Control.)
Public methodRefreshEditRefreshes the value of the current cell with the underlying cell value when the cell is in edit mode, discarding any previous value.
Public methodResetBackColorResets the BackColor property to its default value. (Inherited from Control.)
Public methodResetBindingsCauses a control bound to the BindingSource to reread all the items in the list and refresh their displayed values. (Inherited from Control.)
Public methodResetCursorResets the Cursor property to its default value. (Inherited from Control.)
Public methodResetFontResets the Font property to its default value. (Inherited from Control.)
Public methodResetForeColorResets the ForeColor property to its default value. (Inherited from Control.)
Public methodResetImeModeResets the ImeMode property to its default value. (Inherited from Control.)
Protected methodResetMouseEventArgsInfrastructure. Resets the control to handle the MouseLeave event. (Inherited from Control.)
Public methodResetRightToLeftResets the RightToLeft property to its default value. (Inherited from Control.)
Public methodResetTextInfrastructure. Resets the Text property to its default value. (Overrides Control.ResetText().)
Public methodResumeLayout()Resumes usual layout logic. (Inherited from Control.)
Public methodResumeLayout(Boolean)Resumes usual layout logic, optionally forcing an immediate layout of pending layout requests. (Inherited from Control.)
Protected methodRtlTranslateAlignment(ContentAlignment)Converts the specified ContentAlignment to the appropriate ContentAlignment to support right-to-left text. (Inherited from Control.)
Protected methodRtlTranslateAlignment(HorizontalAlignment)Converts the specified HorizontalAlignment to the appropriate HorizontalAlignment to support right-to-left text. (Inherited from Control.)
Protected methodRtlTranslateAlignment(LeftRightAlignment)Converts the specified LeftRightAlignment to the appropriate LeftRightAlignment to support right-to-left text. (Inherited from Control.)
Protected methodRtlTranslateContentConverts the specified ContentAlignment to the appropriate ContentAlignment to support right-to-left text. (Inherited from Control.)
Protected methodRtlTranslateHorizontalConverts the specified HorizontalAlignment to the appropriate HorizontalAlignment to support right-to-left text. (Inherited from Control.)
Protected methodRtlTranslateLeftRightConverts the specified LeftRightAlignment to the appropriate LeftRightAlignment to support right-to-left text. (Inherited from Control.)
Public methodScale(Single) Obsolete. Scales the control and any child controls. (Inherited from Control.)
Public methodScale(SizeF)Scales the control and all child controls by the specified scaling factor. (Inherited from Control.)
Public methodScale(Single, Single) Obsolete. Scales the entire control and any child controls. (Inherited from Control.)
Protected methodScaleControlScales a control's location, size, padding and margin. (Inherited from Control.)
Protected methodScaleCoreInfrastructure. This method is not relevant for this class. (Inherited from Control.)
Public methodSelect()Activates the control. (Inherited from Control.)
Protected methodSelect(Boolean, Boolean)Activates a child control. Optionally specifies the direction in the tab order to select the control from. (Inherited from Control.)
Public methodSelectAllSelects all the cells in the DataGridView.
Public methodSelectNextControlActivates the next control. (Inherited from Control.)
Public methodSendToBackSends the control to the back of the z-order. (Inherited from Control.)
Protected methodSetAutoSizeModeSets a value indicating how a control will behave when its AutoSize property is enabled. (Inherited from Control.)
Public methodSetBounds(Int32, Int32, Int32, Int32)Sets the bounds of the control to the specified location and size. (Inherited from Control.)
Public methodSetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)Sets the specified bounds of the control to the specified location and size. (Inherited from Control.)
Protected methodSetBoundsCoreThis member overrides Control.SetBoundsCore. (Overrides Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified).)
Protected methodSetClientSizeCoreSets the size of the client area of the control. (Inherited from Control.)
Protected methodSetCurrentCellAddressCoreSets the currently active cell.
Protected methodSetSelectedCellCoreChanges the selection state of the cell with the specified row and column indexes.
Protected methodSetSelectedColumnCoreChanges the selection state of the column with the specified index.
Protected methodSetSelectedRowCoreChanges the selection state of the row with the specified index.
Protected methodSetStyleSets a specified ControlStyles flag to either true or false. (Inherited from Control.)
Protected methodSetTopLevelSets the control as the top-level control. (Inherited from Control.)
Protected methodSetVisibleCoreSets the control to the specified visible state. (Inherited from Control.)
Public methodShowDisplays the control to the user. (Inherited from Control.)
Protected methodSizeFromClientSizeDetermines the size of the entire control from the height and width of its client area. (Inherited from Control.)
Public methodSort(IComparer)Sorts the contents of the DataGridView control using an implementation of the IComparer interface.
Public methodSort(DataGridViewColumn, ListSortDirection)Sorts the contents of the DataGridView control in ascending or descending order based on the contents of the specified column.
Public methodSuspendLayoutTemporarily suspends the layout logic for the control. (Inherited from Control.)
Public methodToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)
Public methodUpdateCauses the control to redraw the invalidated regions within its client area. (Inherited from Control.)
Protected methodUpdateBounds()Updates the bounds of the control with the current size and location. (Inherited from Control.)
Protected methodUpdateBounds(Int32, Int32, Int32, Int32)Updates the bounds of the control with the specified size and location. (Inherited from Control.)
Protected methodUpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)Updates the bounds of the control with the specified size, location, and client size. (Inherited from Control.)
Public methodUpdateCellErrorTextForces the cell at the specified location to update its error text.
Public methodUpdateCellValueForces the control to update its display of the cell at the specified location based on its new value, applying any automatic sizing modes currently in effect.
Public methodUpdateRowErrorText(Int32)Forces the row at the given row index to update its error text.
Public methodUpdateRowErrorText(Int32, Int32)Forces the rows in the given range to update their error text.
Public methodUpdateRowHeightInfoForces the specified row or rows to update their height information.
Protected methodUpdateStylesForces the assigned styles to be reapplied to the control. (Inherited from Control.)
Protected methodUpdateZOrderUpdates the control in its parent's z-order. (Inherited from Control.)
Protected methodWndProcProcesses window messages. (Overrides Control.WndProc(Message).)
Top

  NameDescription
Public eventAllowUserToAddRowsChangedOccurs when the value of the AllowUserToAddRows property changes.
Public eventAllowUserToDeleteRowsChangedOccurs when the value of the AllowUserToDeleteRowsChanged property changes.
Public eventAllowUserToOrderColumnsChangedOccurs when the value of the AllowUserToOrderColumns property changes.
Public eventAllowUserToResizeColumnsChangedOccurs when the value of the AllowUserToResizeColumns property changes.
Public eventAllowUserToResizeRowsChangedOccurs when the value of the AllowUserToResizeRows property changes.
Public eventAlternatingRowsDefaultCellStyleChangedOccurs when the value of the AlternatingRowsDefaultCellStyle property changes.
Public eventAutoGenerateColumnsChangedOccurs when the value of the AutoGenerateColumnsChanged property changes.
Public eventAutoSizeChangedInfrastructure. This event is not relevant for this class. (Inherited from Control.)
Public eventAutoSizeColumnModeChangedOccurs when the value of the AutoSizeMode property of a column changes.
Public eventAutoSizeColumnsModeChangedOccurs when the value of the AutoSizeColumnsMode property changes.
Public eventAutoSizeRowsModeChangedOccurs when the value of the DataGridViewAutoSizeRowsMode property changes.
Public eventBackColorChangedInfrastructure. Occurs when the value of the BackColor property changes.
Public eventBackgroundColorChangedOccurs when the value of the BackgroundColor property changes.
Public eventBackgroundImageChangedInfrastructure. Occurs when the value of the BackgroundImage property changes.
Public eventBackgroundImageLayoutChangedInfrastructure. Occurs when the BackgroundImageLayout property changes.
Public eventBindingContextChangedOccurs when the value of the BindingContext property changes. (Inherited from Control.)
Public eventBorderStyleChangedOccurs when the value of the BorderStyle property changes.
Public eventCancelRowEditOccurs when the VirtualMode property of a DataGridView control is true and the cancels edits in a row.
Public eventCausesValidationChangedOccurs when the value of the CausesValidation property changes. (Inherited from Control.)
Public eventCellBeginEditOccurs when edit mode starts for the selected cell.
Public eventCellBorderStyleChangedOccurs when the border style of a cell changes.
Public eventCellClickOccurs when any part of a cell is clicked.
Public eventCellContentClickOccurs when the content within a cell is clicked.
Public eventCellContentDoubleClickOccurs when the user double-clicks a cell's contents.
Public eventCellContextMenuStripChangedOccurs when the ContextMenuStrip property changes.
Public eventCellContextMenuStripNeededOccurs when a cell's shortcut menu is needed.
Public eventCellDoubleClickOccurs when the user double-clicks anywhere in a cell.
Public eventCellEndEditOccurs when edit mode stops for the currently selected cell.
Public eventCellEnterOccurs when the current cell changes in the DataGridView control or when the control receives input focus.
Public eventCellErrorTextChangedOccurs when the value of the ErrorText property of a cell changes.
Public eventCellErrorTextNeededOccurs when a cell's error text is needed.
Public eventCellFormattingOccurs when the contents of a cell need to be formatted for display.
Public eventCellLeaveOccurs when a cell loses input focus and is no longer the current cell.
Public eventCellMouseClickOccurs whenever the user clicks anywhere on a cell with the mouse.
Public eventCellMouseDoubleClickOccurs when a cell within the DataGridView is double-clicked.
Public eventCellMouseDownOccurs when the user presses a mouse button while the mouse pointer is within the boundaries of a cell.
Public eventCellMouseEnterOccurs when the mouse pointer enters a cell.
Public eventCellMouseLeaveOccurs when the mouse pointer leaves a cell.
Public eventCellMouseMoveOccurs when the mouse pointer moves over the DataGridView control.
Public eventCellMouseUpOccurs when the user releases a mouse button while over a cell.
Public eventCellPaintingOccurs when a cell needs to be drawn.
Public eventCellParsingOccurs when a cell leaves edit mode if the cell value has been modified.
Public eventCellStateChangedOccurs when a cell state changes, such as when the cell loses or gains focus.
Public eventCellStyleChangedOccurs when the Style property of a DataGridViewCell changes.
Public eventCellStyleContentChangedOccurs when one of the values of a cell style changes.
Public eventCellToolTipTextChangedOccurs when the ToolTipText property value changes for a cell in the DataGridView.
Public eventCellToolTipTextNeededOccurs when a cell's ToolTip text is needed.
Public eventCellValidatedOccurs after the cell has finished validating.
Public eventCellValidatingOccurs when a cell loses input focus, enabling content validation.
Public eventCellValueChangedOccurs when the value of a cell changes.
Public eventCellValueNeededOccurs when the VirtualMode property of the DataGridView control is true and the DataGridView requires a value for a cell in order to format and display the cell.
Public eventCellValuePushedOccurs when the VirtualMode property of the DataGridView control is true and a cell value has changed and requires storage in the underlying data source.
Public eventChangeUICuesOccurs when the focus or keyboard user interface (UI) cues change. (Inherited from Control.)
Public eventClickOccurs when the control is clicked. (Inherited from Control.)
Public eventClientSizeChangedOccurs when the value of the ClientSize property changes. (Inherited from Control.)
Public eventColumnAddedOccurs when a column is added to the control.
Public eventColumnContextMenuStripChangedOccurs when the ContextMenuStrip property of a column changes.
Public eventColumnDataPropertyNameChangedOccurs when the value of the DataPropertyName property for a column changes.
Public eventColumnDefaultCellStyleChangedOccurs when the value of the DefaultCellStyle property for a column changes.
Public eventColumnDisplayIndexChangedOccurs when the value the DisplayIndex property for a column changes.
Public eventColumnDividerDoubleClickOccurs when the user double-clicks a divider between two columns.
Public eventColumnDividerWidthChangedOccurs when the DividerWidth property changes.
Public eventColumnHeaderCellChangedOccurs when the contents of a column header cell change.
Public eventColumnHeaderMouseClickOccurs when the user clicks a column header.
Public eventColumnHeaderMouseDoubleClickOccurs when a column header is double-clicked.
Public eventColumnHeadersBorderStyleChangedOccurs when the ColumnHeadersBorderStyle property changes.
Public eventColumnHeadersDefaultCellStyleChangedOccurs when the value of the ColumnHeadersDefaultCellStyle property changes.
Public eventColumnHeadersHeightChangedOccurs when the value of the ColumnHeadersHeight property changes.
Public eventColumnHeadersHeightSizeModeChangedOccurs when the value of the ColumnHeadersHeightSizeMode property changes.
Public eventColumnMinimumWidthChangedOccurs when the value of the MinimumWidth property for a column changes.
Public eventColumnNameChangedOccurs when the value of the Name property for a column changes.
Public eventColumnRemovedOccurs when a column is removed from the control.
Public eventColumnSortModeChangedOccurs when the value of the SortMode property for a column changes.
Public eventColumnStateChangedOccurs when a column changes state, such as gaining or losing focus.
Public eventColumnToolTipTextChangedOccurs when the ToolTipText property value changes for a column in the DataGridView.
Public eventColumnWidthChangedOccurs when the value of the Width property for a column changes.
Public eventContextMenuChangedOccurs when the value of the ContextMenu property changes. (Inherited from Control.)
Public eventContextMenuStripChangedOccurs when the value of the ContextMenuStrip property changes. (Inherited from Control.)
Public eventControlAddedOccurs when a new control is added to the Control.ControlCollection. (Inherited from Control.)
Public eventControlRemovedOccurs when a control is removed from the Control.ControlCollection. (Inherited from Control.)
Public eventCurrentCellChangedOccurs when the CurrentCell property changes.
Public eventCurrentCellDirtyStateChangedOccurs when the state of a cell changes in relation to a change in its contents.
Public eventCursorChangedOccurs when the value of the Cursor property changes. (Inherited from Control.)
Public eventDataBindingCompleteOccurs after a data-binding operation has finished.
Public eventDataErrorOccurs when an external data-parsing or validation operation throws an exception, or when an attempt to commit data to a data source fails.
Public eventDataMemberChangedOccurs when value of the DataMember property changes.
Public eventDataSourceChangedOccurs when the value of the DataSource property changes.
Public eventDefaultCellStyleChangedOccurs when the value of the DefaultCellStyle property changes.
Public eventDefaultValuesNeededOccurs when the user enters the row for new records so that it can be populated with default values.
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Public eventDockChangedOccurs when the value of the Dock property changes. (Inherited from Control.)
Public eventDoubleClickOccurs when the control is double-clicked. (Inherited from Control.)
Public eventDragDropOccurs when a drag-and-drop operation is completed. (Inherited from Control.)
Public eventDragEnterOccurs when an object is dragged into the control's bounds. (Inherited from Control.)
Public eventDragLeaveOccurs when an object is dragged out of the control's bounds. (Inherited from Control.)
Public eventDragOverOccurs when an object is dragged over the control's bounds. (Inherited from Control.)
Public eventEditingControlShowingOccurs when a control for editing a cell is showing.
Public eventEditModeChangedOccurs when the value of the EditMode property changes.
Public eventEnabledChangedOccurs when the Enabled property value has changed. (Inherited from Control.)
Public eventEnterOccurs when the control is entered. (Inherited from Control.)
Public eventFontChangedOccurs when the Font property value changes.
Public eventForeColorChangedOccurs when the ForeColor property value changes.
Public eventGiveFeedbackOccurs during a drag operation. (Inherited from Control.)
Public eventGotFocusOccurs when the control receives focus. (Inherited from Control.)
Public eventGridColorChangedOccurs when the value of the GridColor property changes.
Public eventHandleCreatedOccurs when a handle is created for the control. (Inherited from Control.)
Public eventHandleDestroyedOccurs when the control's handle is in the process of being destroyed. (Inherited from Control.)
Public eventHelpRequestedOccurs when the user requests help for a control. (Inherited from Control.)
Public eventImeModeChangedOccurs when the ImeMode property has changed. (Inherited from Control.)
Public eventInvalidatedOccurs when a control's display requires redrawing. (Inherited from Control.)
Public eventKeyDownOccurs when a key is pressed while the control has focus. (Inherited from Control.)
Public eventKeyPressOccurs when a key is pressed while the control has focus. (Inherited from Control.)
Public eventKeyUpOccurs when a key is released while the control has focus. (Inherited from Control.)
Public eventLayoutOccurs when a control should reposition its child controls. (Inherited from Control.)
Public eventLeaveOccurs when the input focus leaves the control. (Inherited from Control.)
Public eventLocationChangedOccurs when the Location property value has changed. (Inherited from Control.)
Public eventLostFocusOccurs when the control loses focus. (Inherited from Control.)
Public eventMarginChangedOccurs when the control's margin changes. (Inherited from Control.)
Public eventMouseCaptureChangedOccurs when the control loses mouse capture. (Inherited from Control.)
Public eventMouseClickOccurs when the control is clicked by the mouse. (Inherited from Control.)
Public eventMouseDoubleClickOccurs when the control is double clicked by the mouse. (Inherited from Control.)
Public eventMouseDownOccurs when the mouse pointer is over the control and a mouse button is pressed. (Inherited from Control.)
Public eventMouseEnterOccurs when the mouse pointer enters the control. (Inherited from Control.)
Public eventMouseHoverOccurs when the mouse pointer rests on the control. (Inherited from Control.)
Public eventMouseLeaveOccurs when the mouse pointer leaves the control. (Inherited from Control.)
Public eventMouseMoveOccurs when the mouse pointer is moved over the control. (Inherited from Control.)
Public eventMouseUpOccurs when the mouse pointer is over the control and a mouse button is released. (Inherited from Control.)
Public eventMouseWheelOccurs when the mouse wheel moves while the control has focus. (Inherited from Control.)
Public eventMoveOccurs when the control is moved. (Inherited from Control.)
Public eventMultiSelectChangedOccurs when the value of the MultiSelect property changes.
Public eventNewRowNeededOccurs when the VirtualMode property of the DataGridView is true and the user navigates to the new row at the bottom of the DataGridView.
Public eventPaddingChangedInfrastructure. Occurs when the value of the Padding property changes.
Public eventPaintOccurs when the control is redrawn. (Inherited from Control.)
Public eventParentChangedOccurs when the Parent property value changes. (Inherited from Control.)
Public eventPreviewKeyDownOccurs before the KeyDown event when a key is pressed while focus is on this control. (Inherited from Control.)
Public eventQueryAccessibilityHelpOccurs when AccessibleObject is providing help to accessibility applications. (Inherited from Control.)
Public eventQueryContinueDragOccurs during a drag-and-drop operation and enables the drag source to determine whether the drag-and-drop operation should be canceled. (Inherited from Control.)
Public eventReadOnlyChangedOccurs when the ReadOnly property changes.
Public eventRegionChangedOccurs when the value of the Region property changes. (Inherited from Control.)
Public eventResizeOccurs when the control is resized. (Inherited from Control.)
Public eventRightToLeftChangedOccurs when the RightToLeft property value changes. (Inherited from Control.)
Public eventRowContextMenuStripChangedOccurs when the ContextMenuStrip property changes.
Public eventRowContextMenuStripNeededOccurs when a row's shortcut menu is needed.
Public eventRowDefaultCellStyleChangedOccurs when the value of the DefaultCellStyle property for a row changes.
Public eventRowDirtyStateNeededOccurs when the VirtualMode property of the DataGridView control is true and the DataGridView needs to determine whether the current row has uncommitted changes.
Public eventRowDividerDoubleClickOccurs when the user double-clicks the divider between two rows.
Public eventRowDividerHeightChangedOccurs when the DividerHeight property changes.
Public eventRowEnterOccurs when a row receives input focus but before it becomes the current row.
Public eventRowErrorTextChangedOccurs when the ErrorText property of a row changes.
Public eventRowErrorTextNeededOccurs when a row's error text is needed.
Public eventRowHeaderCellChangedOccurs when the user changes the contents of a row header cell.
Public eventRowHeaderMouseClickOccurs when the user clicks within the boundaries of a row header.
Public eventRowHeaderMouseDoubleClickOccurs when a row header is double-clicked.
Public eventRowHeadersBorderStyleChangedOccurs when the RowHeadersBorderStyle property changes.
Public eventRowHeadersDefaultCellStyleChangedOccurs when the value of the RowHeadersDefaultCellStyle property changes.
Public eventRowHeadersWidthChangedOccurs when value of the RowHeadersWidth property changes.
Public eventRowHeadersWidthSizeModeChangedOccurs when the value of the RowHeadersWidthSizeMode property changes.
Public eventRowHeightChangedOccurs when the value of the Height property for a row changes.
Public eventRowHeightInfoNeededOccurs when information about row height is requested.
Public eventRowHeightInfoPushedOccurs when the user changes the height of a row.
Public eventRowLeaveOccurs when a row loses input focus and is no longer the current row.
Public eventRowMinimumHeightChangedOccurs when the value of the MinimumHeight property for a row changes.
Public eventRowPostPaintOccurs after a DataGridViewRow is painted.
Public eventRowPrePaintOccurs before a DataGridViewRow is painted
Public eventRowsAddedOccurs after a new row is added to the DataGridView.
Public eventRowsDefaultCellStyleChangedOccurs when the value of the RowsDefaultCellStyle property changes.
Public eventRowsRemovedOccurs when a row or rows are deleted from the DataGridView.
Public eventRowStateChangedOccurs when a row changes state, such as losing or gaining input focus.
Public eventRowUnsharedOccurs when a row's state changes from shared to unshared.
Public eventRowValidatedOccurs after a row has finished validating.
Public eventRowValidatingOccurs when a row is validating.
Public eventScrollOccurs when the user scrolls through the control contents.
Public eventSelectionChangedOccurs when the current selection changes.
Public eventSizeChangedOccurs when the Size property value changes. (Inherited from Control.)
Public eventSortCompareOccurs when the DataGridView compares two cell values to perform a sort operation.
Public eventSortedOccurs when the DataGridView control completes a sorting operation.
Public eventStyleChangedInfrastructure. Occurs when the control style changes.
Public eventSystemColorsChangedOccurs when the system colors change. (Inherited from Control.)
Public eventTabIndexChangedOccurs when the TabIndex property value changes. (Inherited from Control.)
Public eventTabStopChangedOccurs when the TabStop property value changes. (Inherited from Control.)
Public eventTextChangedInfrastructure. Occurs when the value of the Text property changes.
Public eventUserAddedRowOccurs when the user has finished adding a row to the DataGridView control.
Public eventUserDeletedRowOccurs when the user has finished deleting a row from the DataGridView control.
Public eventUserDeletingRowOccurs when the user deletes a row from the DataGridView control.
Public eventValidatedOccurs when the control is finished validating. (Inherited from Control.)
Public eventValidatingOccurs when the control is validating. (Inherited from Control.)
Public eventVisibleChangedOccurs when the Visible property value changes. (Inherited from Control.)
Top

  NameDescription
Explicit interface implemetationPrivate methodIDropTarget.OnDragDropInfrastructure. Raises the DragDrop event. (Inherited from Control.)
Explicit interface implemetationPrivate methodIDropTarget.OnDragEnterInfrastructure. Raises the DragEnter event. (Inherited from Control.)
Explicit interface implemetationPrivate methodIDropTarget.OnDragLeaveInfrastructure. Raises the DragLeave event. (Inherited from Control.)
Explicit interface implemetationPrivate methodIDropTarget.OnDragOverInfrastructure. Raises the DragOver event. (Inherited from Control.)
Explicit interface implemetationPrivate methodISupportInitialize.BeginInitFor a description of this member, see BeginInit.
Explicit interface implemetationPrivate methodISupportInitialize.EndInitFor a description of this member, see EndInit.
Top

The DataGridView control provides a customizable table for displaying data. The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor. For more information, see Basic Formatting and Styling in the Windows Forms DataGridView Control.

You can use a DataGridView control to display data with or without an underlying data source. Without specifying a data source, you can create columns and rows that contain data and add them directly to the DataGridView using the Rows and Columns properties. You can also use the Rows collection to access DataGridViewRow objects and the DataGridViewRow.Cells property to read or write cell values directly. The Item indexer also provides direct access to cells.

As an alternative to populating the control manually, you can set the DataSource and DataMember properties to bind the DataGridView to a data source and automatically populate it with data. For more information, see Displaying Data in the Windows Forms DataGridView Control.

When working with very large amounts of data, you can set the VirtualMode property to true to display a subset of the available data. Virtual mode requires the implementation of a data cache from which the DataGridView control is populated. For more information, see Data Display Modes in the Windows Forms DataGridView Control.

For additional information about the features available in the DataGridView control, see DataGridView Control (Windows Forms). The following table provides direct links to common tasks.

TopicLocation
How to: Change the Type of a Windows Forms DataGridView Column Using the Designer
How to: Bind Data to the Windows Forms DataGridView Control Using the Designer
How to: Set Default Cell Styles and Data Formats for the Windows Forms DataGridView Control Using the Designer
How to: Change the Type of a Windows Forms DataGridView Column Using the DesignerWindows Forms Controls
How to: Bind Data to the Windows Forms DataGridView Control Using the DesignerWindows Forms Controls
How to: Set Default Cell Styles and Data Formats for the Windows Forms DataGridView Control Using the DesignerWindows Forms Controls
How to: Bind Data to the Windows Forms DataGridView Control
How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView Control
How to: Set Font and Color Styles in the Windows Forms DataGridView Control
How to: Format Data in the Windows Forms DataGridView Control
Walkthrough: Validating Data in the Windows Forms DataGridView Control
How to: Customize Data Formatting in the Windows Forms DataGridView Control
Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls
How to: Bind Data to the Windows Forms DataGridView ControlWindows Forms Controls in the .NET Framework SDK
How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView ControlWindows Forms Controls in the .NET Framework SDK
How to: Set Font and Color Styles in the Windows Forms DataGridView ControlWindows Forms Controls in the .NET Framework SDK
How to: Format Data in the Windows Forms DataGridView ControlWindows Forms Controls in the .NET Framework SDK
Walkthrough: Validating Data in the Windows Forms DataGridView ControlWindows Forms Controls in the .NET Framework SDK
How to: Customize Data Formatting in the Windows Forms DataGridView ControlWindows Forms Controls in the .NET Framework SDK
Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView ControlsWindows Forms Controls in the .NET Framework SDK
How to: Bind Data to the Windows Forms DataGridView Control
How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView Control
How to: Set Font and Color Styles in the Windows Forms DataGridView Control
How to: Change the Type of a Windows Forms DataGridView Column Using the Designer
How to: Bind Data to the Windows Forms DataGridView Control Using the Designer
How to: Set Default Cell Styles and Data Formats for the Windows Forms DataGridView Control Using the Designer
How to: Format Data in the Windows Forms DataGridView Control
Walkthrough: Validating Data in the Windows Forms DataGridView Control
How to: Customize Data Formatting in the Windows Forms DataGridView Control
Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls

Although the DataGridView control replaces and adds functionality to the DataGrid control of previous versions, the DataGrid control is retained for both backward compatibility and future use if you choose. For more information, see Differences Between the Windows Forms DataGridView and DataGrid Controls.

NoteNote

The DataGridView control inherits both the ContextMenu and ContextMenuStrip properties from Control, but supports only the ContextMenuStrip property. Using the ContextMenu property with the DataGridView control has no effect.

The following code example demonstrates how to initialize an unbound DataGridView control.


using System;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
    private Panel buttonPanel = new Panel();
    private DataGridView songsDataGridView = new DataGridView();
    private Button addNewRowButton = new Button();
    private Button deleteRowButton = new Button();

    public Form1()
    {
        this.Load += new EventHandler(Form1_Load);
    }

    private void Form1_Load(System.Object sender, System.EventArgs e)
    {
        SetupLayout();
        SetupDataGridView();
        PopulateDataGridView();
    }

    private void songsDataGridView_CellFormatting(object sender,
        System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
    {
        if (e != null)
        {
            if (this.songsDataGridView.Columns[e.ColumnIndex].Name == "Release Date")
            {
                if (e.Value != null)
                {
                    try
                    {
                        e.Value = DateTime.Parse(e.Value.ToString())
                            .ToLongDateString();
                        e.FormattingApplied = true;
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("{0} is not a valid date.", e.Value.ToString());
                    }
                }
            }
        }
    }

    private void addNewRowButton_Click(object sender, EventArgs e)
    {
        this.songsDataGridView.Rows.Add();
    }

    private void deleteRowButton_Click(object sender, EventArgs e)
    {
        if (this.songsDataGridView.SelectedRows.Count > 0 &&
            this.songsDataGridView.SelectedRows[0].Index !=
            this.songsDataGridView.Rows.Count - 1)
        {
            this.songsDataGridView.Rows.RemoveAt(
                this.songsDataGridView.SelectedRows[0].Index);
        }
    }

    private void SetupLayout()
    {
        this.Size = new Size(600, 500);

        addNewRowButton.Text = "Add Row";
        addNewRowButton.Location = new Point(10, 10);
        addNewRowButton.Click += new EventHandler(addNewRowButton_Click);

        deleteRowButton.Text = "Delete Row";
        deleteRowButton.Location = new Point(100, 10);
        deleteRowButton.Click += new EventHandler(deleteRowButton_Click);

        buttonPanel.Controls.Add(addNewRowButton);
        buttonPanel.Controls.Add(deleteRowButton);
        buttonPanel.Height = 50;
        buttonPanel.Dock = DockStyle.Bottom;

        this.Controls.Add(this.buttonPanel);
    }

    private void SetupDataGridView()
    {
        this.Controls.Add(songsDataGridView);

        songsDataGridView.ColumnCount = 5;

        songsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.Navy;
        songsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
        songsDataGridView.ColumnHeadersDefaultCellStyle.Font =
            new Font(songsDataGridView.Font, FontStyle.Bold);

        songsDataGridView.Name = "songsDataGridView";
        songsDataGridView.Location = new Point(8, 8);
        songsDataGridView.Size = new Size(500, 250);
        songsDataGridView.AutoSizeRowsMode =
            DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
        songsDataGridView.ColumnHeadersBorderStyle =
            DataGridViewHeaderBorderStyle.Single;
        songsDataGridView.CellBorderStyle = DataGridViewCellBorderStyle.Single;
        songsDataGridView.GridColor = Color.Black;
        songsDataGridView.RowHeadersVisible = false;

        songsDataGridView.Columns[0].Name = "Release Date";
        songsDataGridView.Columns[1].Name = "Track";
        songsDataGridView.Columns[2].Name = "Title";
        songsDataGridView.Columns[3].Name = "Artist";
        songsDataGridView.Columns[4].Name = "Album";
        songsDataGridView.Columns[4].DefaultCellStyle.Font =
            new Font(songsDataGridView.DefaultCellStyle.Font, FontStyle.Italic);

        songsDataGridView.SelectionMode =
            DataGridViewSelectionMode.FullRowSelect;
        songsDataGridView.MultiSelect = false;
        songsDataGridView.Dock = DockStyle.Fill;

        songsDataGridView.CellFormatting += new
            DataGridViewCellFormattingEventHandler(
            songsDataGridView_CellFormatting);
    }

    private void PopulateDataGridView()
    {

        string[] row0 = { "11/22/1968", "29", "Revolution 9", 
            "Beatles", "The Beatles [White Album]" };
        string[] row1 = { "1960", "6", "Fools Rush In", 
            "Frank Sinatra", "Nice 'N' Easy" };
        string[] row2 = { "11/11/1971", "1", "One of These Days", 
            "Pink Floyd", "Meddle" };
        string[] row3 = { "1988", "7", "Where Is My Mind?", 
            "Pixies", "Surfer Rosa" };
        string[] row4 = { "5/1981", "9", "Can't Find My Mind", 
            "Cramps", "Psychedelic Jungle" };
        string[] row5 = { "6/10/2003", "13", 
            "Scatterbrain. (As Dead As Leaves.)", 
            "Radiohead", "Hail to the Thief" };
        string[] row6 = { "6/30/1992", "3", "Dress", "P J Harvey", "Dry" };

        songsDataGridView.Rows.Add(row0);
        songsDataGridView.Rows.Add(row1);
        songsDataGridView.Rows.Add(row2);
        songsDataGridView.Rows.Add(row3);
        songsDataGridView.Rows.Add(row4);
        songsDataGridView.Rows.Add(row5);
        songsDataGridView.Rows.Add(row6);

        songsDataGridView.Columns[0].DisplayIndex = 3;
        songsDataGridView.Columns[1].DisplayIndex = 4;
        songsDataGridView.Columns[2].DisplayIndex = 0;
        songsDataGridView.Columns[3].DisplayIndex = 1;
        songsDataGridView.Columns[4].DisplayIndex = 2;
    }


    [STAThreadAttribute()]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft