System.Windows.Forms.DataGrid Members

The members of System.Windows.Forms.DataGrid are listed below.

See Also: Inherited members from System.Windows.Forms.Control

Public Constructors

Initializes a new instance of the System.Windows.Forms.DataGrid class.

Public Properties

AllowNavigationbool.

Gets or sets a value indicating whether navigation is allowed.

AllowSortingbool.

Gets or sets a value indicating whether the grid can be resorted by clicking on a column header.

AlternatingBackColorSystem.Drawing.Color.

Gets or sets the background color of odd-numbered rows of the grid.

override
BackColorSystem.Drawing.Color.

Gets or sets the background color of even-numbered rows of the grid.

BackgroundColorSystem.Drawing.Color.

Gets or sets the color of the non-row area of the grid.

override
BackgroundImageSystem.Drawing.Image.

This member is not meaningful for this control.

override
BackgroundImageLayoutImageLayout.

This member is not meaningful for this control.

BorderStyleBorderStyle.

Gets or sets the grid's border style.

CaptionBackColorSystem.Drawing.Color.

Gets or sets the background color of the caption area.

CaptionFontSystem.Drawing.Font.

Gets or sets the font of the grid's caption.

CaptionForeColorSystem.Drawing.Color.

Gets or sets the foreground color of the caption area.

CaptionTextstring.

Gets or sets the text of the grid's window caption.

CaptionVisiblebool.

Gets or sets a value that indicates whether the grid's caption is visible.

ColumnHeadersVisiblebool.

Gets or sets a value indicating whether the column headers of a table are visible.

CurrentCellDataGridCell.

Gets or sets which cell has the focus. Not available at design time.

CurrentRowIndexint.

Gets or sets index of the row that currently has focus.

override
CursorCursor.

This member is not meaningful for this control.

DataMemberstring.

Gets or sets the specific list in a DataGrid.DataSource for which the System.Windows.Forms.DataGrid control displays a grid.

DataSourceobject.

Gets or sets the data source that the grid is displaying data for.

[read-only]
FirstVisibleColumnint.

Gets the index of the first visible column in a grid.

FlatModebool.

Gets or sets a value indicating whether the grid displays in flat mode.

override
ForeColorSystem.Drawing.Color.

Gets or sets the foreground color (typically the color of the text) property of the System.Windows.Forms.DataGrid control.

GridLineColorSystem.Drawing.Color.

Gets or sets the color of the grid lines.

GridLineStyleDataGridLineStyle.

Gets or sets the line style of the grid.

HeaderBackColorSystem.Drawing.Color.

Gets or sets the background color of all row and column headers.

HeaderFontSystem.Drawing.Font.

Gets or sets the font used for column headers.

HeaderForeColorSystem.Drawing.Color.

Gets or sets the foreground color of headers.

default property
Item(DataGridCell)object. Documentation for this section has not yet been entered.
default property
Item(int, int)object. Documentation for this section has not yet been entered.
LinkColorSystem.Drawing.Color.

Gets or sets the color of the text that you can click to navigate to a child table.

LinkHoverColorSystem.Drawing.Color.

This member is not meaningful for this control.

ParentRowsBackColorSystem.Drawing.Color.

Gets or sets the background color of parent rows.

ParentRowsForeColorSystem.Drawing.Color.

Gets or sets the foreground color of parent rows.

ParentRowsLabelStyleDataGridParentRowsLabelStyle.

Gets or sets the way parent row labels are displayed.

ParentRowsVisiblebool.

Gets or sets a value indicating whether the parent rows of a table are visible.

PreferredColumnWidthint.

Gets or sets the default width of the grid columns in pixels.

PreferredRowHeightint.

Gets or sets the preferred row height for the System.Windows.Forms.DataGrid control.

ReadOnlybool.

Gets or sets a value indicating whether the grid is in read-only mode.

RowHeadersVisiblebool.

Gets or sets a value that specifies whether row headers are visible.

RowHeaderWidthint.

Gets or sets the width of row headers.

SelectionBackColorSystem.Drawing.Color.

Gets or sets the background color of selected rows.

SelectionForeColorSystem.Drawing.Color.

Gets or set the foreground color of selected rows.

override
SiteSystem.ComponentModel.ISite. Documentation for this section has not yet been entered.
[read-only]
TableStylesGridTableStylesCollection.

Gets the collection of System.Windows.Forms.DataGridTableStyle objects for the grid.

override
Textstring.

This member is not meaningful for this control.

[read-only]
VisibleColumnCountint.

Gets the number of visible columns.

[read-only]
VisibleRowCountint.

Gets the number of rows visible.

Protected Properties

[read-only]
override
DefaultSizeSystem.Drawing.Size.

Gets the default size of the control.

[read-only]
HorizScrollBarScrollBar.

Gets the horizontal scroll bar for the grid.

ListManagerCurrencyManager.

Gets the System.Windows.Forms.CurrencyManager for this System.Windows.Forms.DataGrid control.

[read-only]
VertScrollBarScrollBar.

Gets the vertical scroll bar of the control.

Public Methods

BeginEdit(DataGridColumnStyle, int) : bool

Attempts to put the grid into a state where editing is allowed.

BeginInit()

Begins the initialization of a System.Windows.Forms.DataGrid that is used on a form or used by another component. The initialization occurs at run time.

Collapse(int)

Collapses child relations, if any exist for all rows, or for a specified row.

EndEdit(DataGridColumnStyle, int, bool) : bool

Requests an end to an edit operation taking place on the System.Windows.Forms.DataGrid control.

EndInit()

Ends the initialization of a System.Windows.Forms.DataGrid that is used on a form or used by another component. The initialization occurs at run time.

Expand(int)

Displays child relations, if any exist, for all rows or a specific row.

GetCellBounds(DataGridCell) : System.Drawing.Rectangle

Gets the System.Drawing.Rectangle of the cell specified by System.Windows.Forms.DataGridCell.

GetCellBounds(int, int) : System.Drawing.Rectangle

Gets the System.Drawing.Rectangle of the cell specified by row and column number.

GetCurrentCellBounds() : System.Drawing.Rectangle

Gets a System.Drawing.Rectangle that specifies the four corners of the selected cell.

HitTest(System.Drawing.Point) : DataGrid.HitTestInfo

Gets information, such as row and column number of a clicked point on the grid, about the grid using a specific System.Drawing.Point.

HitTest(int, int) : DataGrid.HitTestInfo

Gets information, such as row and column number of a clicked point on the grid, using the x and y coordinate passed to the method.

IsExpanded(int) : bool

Gets a value that indicates whether the node of a specified row is expanded or collapsed.

IsSelected(int) : bool

Gets a value indicating whether a specified row is selected.

NavigateBack()

Navigates back to the table previously displayed in the grid.

NavigateTo(int, string)

Navigates to the table specified by row and relation name.

ResetAlternatingBackColor()

Resets the DataGrid.AlternatingBackColor property to its default color.

override
ResetBackColor()

Resets the DataGrid.BackColor property to its default value.

override
ResetForeColor()

Resets the DataGrid.ForeColor property to its default value.

ResetGridLineColor()

Resets the DataGrid.GridLineColor property to its default value.

ResetHeaderBackColor()

Resets the DataGrid.HeaderBackColor property to its default value.

ResetHeaderFont()

Resets the DataGrid.HeaderFont property to its default value.

ResetHeaderForeColor()

Resets the DataGrid.HeaderForeColor property to its default value.

ResetLinkColor()

Resets the DataGrid.LinkColor property to its default value.

ResetLinkHoverColor()

Resets the DataGrid.LinkHoverColor property to its default value.

ResetSelectionBackColor()

Resets the DataGrid.SelectionBackColor property to its default value.

ResetSelectionForeColor()

Resets the DataGrid.SelectionForeColor property to its default value.

Select(int)

Selects a specified row.

SetDataBinding(object, string)

Sets the DataGrid.DataSource and DataGrid.DataMember properties at run time.

SubObjectsSiteChange(bool)

Adds or removes the System.Windows.Forms.DataGridTableStyle objects from the container that is associated with the System.Windows.Forms.DataGrid.

UnSelect(int)

Unselects a specified row.

Protected Methods

CancelEditing()

Cancels the current edit operation and rolls back all changes.

ColumnStartedEditing(System.Drawing.Rectangle)

Informs the System.Windows.Forms.DataGrid control when the user begins to edit the column at the specified location.

ColumnStartedEditing(Control)

Informs the System.Windows.Forms.DataGrid control when the user begins to edit a column using the specified control.

override
CreateAccessibilityInstance() : AccessibleObject

Constructs a new instance of the accessibility object for this control.

CreateGridColumn(System.ComponentModel.PropertyDescriptor) : DataGridColumnStyle

Creates a new System.Windows.Forms.DataGridColumnStyle with the specified System.ComponentModel.PropertyDescriptor.

CreateGridColumn(System.ComponentModel.PropertyDescriptor, bool) : DataGridColumnStyle

Creates a System.Windows.Forms.DataGridColumnStyle using the specified System.ComponentModel.PropertyDescriptor.

override
Dispose(bool)

Disposes of the resources (other than memory) used by the System.Windows.Forms.DataGrid.

GetOutputTextDelimiter() : string

Gets the string that is the delimiter between columns when row contents are copied to the Clipboard.

GridHScrolled(object, ScrollEventArgs)

Listens for the scroll event of the horizontal scroll bar.

GridVScrolled(object, ScrollEventArgs)

Listens for the scroll event of the vertical scroll bar.

OnAllowNavigationChanged(EventArgs)

Raises the DataGrid.AllowNavigationChanged event.

OnBackButtonClicked(object, EventArgs)

Listens for the caption's back button clicked event.

override
OnBackColorChanged(EventArgs)

Raises the Control.BackColorChanged event.

OnBackgroundColorChanged(EventArgs)

Raises the DataGrid.BackgroundColorChanged event.

override
OnBindingContextChanged(EventArgs)

Raises the Control.BindingContextChanged event.

OnBorderStyleChanged(EventArgs)

Raises the DataGrid.BorderStyleChanged event.

OnCaptionVisibleChanged(EventArgs)

Raises the DataGrid.CaptionVisibleChanged event.

OnCurrentCellChanged(EventArgs)

Raises the DataGrid.CurrentCellChanged event.

OnDataSourceChanged(EventArgs)

Raises the DataGrid.DataSourceChanged event.

override
OnEnter(EventArgs)

Raises the Control.Enter event.

OnFlatModeChanged(EventArgs)

Raises the DataGrid.FlatModeChanged event.

override
OnFontChanged(EventArgs)

Raises the Control.FontChanged event.

override
OnForeColorChanged(EventArgs)

Raises the Control.ForeColorChanged event.

override
OnHandleCreated(EventArgs)

Raises the Control.CreateHandle event.

override
OnHandleDestroyed(EventArgs)

Raises the Control.DestroyHandle event.

override
OnKeyDown(KeyEventArgs)

Raises the Control.KeyDown event.

override
OnKeyPress(KeyPressEventArgs)

Raises the Control.KeyPress event.

override
OnLayout(LayoutEventArgs)

Raises the Control.Layout event, which repositions controls and updates scroll bars.

override
OnLeave(EventArgs)

Raises the Control.Leave event.

override
OnMouseDown(MouseEventArgs)

Raises the Control.MouseDown event.

override
OnMouseLeave(EventArgs)

Creates the Control.MouseLeave event.

override
OnMouseMove(MouseEventArgs)

Raises the Control.MouseMove event.

override
OnMouseUp(MouseEventArgs)

Raises the Control.MouseUp event.

override
OnMouseWheel(MouseEventArgs)

Raises the Control.MouseWheel event.

OnNavigate(NavigateEventArgs)

Raises the DataGrid.Navigate event.

override
OnPaint(PaintEventArgs)

Raises the Control.Paint event.

override
OnPaintBackground(PaintEventArgs)

Overrides Control.OnPaintBackground(PaintEventArgs) to prevent painting the background of the System.Windows.Forms.DataGrid control.

OnParentRowsLabelStyleChanged(EventArgs)

Raises the DataGrid.ParentRowsLabelStyleChanged event.

OnParentRowsVisibleChanged(EventArgs)

Raises the DataGrid.ParentRowsVisibleChanged event.

OnReadOnlyChanged(EventArgs)

Raises the DataGrid.ReadOnlyChanged event

override
OnResize(EventArgs)

Raises the Control.Resize event.

OnRowHeaderClick(EventArgs)

Raises the DataGrid.RowHeaderClick event.

OnScroll(EventArgs)

Raises the DataGrid.Scroll event.

OnShowParentDetailsButtonClicked(object, EventArgs)

Raises the DataGrid.ShowParentDetailsButtonClick event.

override
ProcessDialogKey(Keys) : bool

Gets or sets a value that indicates whether a key should be processed further.

ProcessGridKey(KeyEventArgs) : bool

Processes keys for grid navigation.

override
ProcessKeyPreview(ref Message) : bool
Documentation for this section has not yet been entered.
ProcessTabKey(Keys) : bool

Gets a value indicating whether the Tab key should be processed.

ResetSelection()

Turns off selection for all rows that are selected.

ShouldSerializeAlternatingBackColor() : bool

Indicates whether the DataGrid.AlternatingBackColor property should be persisted.

ShouldSerializeBackgroundColor() : bool

Indicates whether the DataGrid.BackgroundColor property should be persisted.

ShouldSerializeCaptionBackColor() : bool

Gets a value indicating whether the DataGrid.CaptionBackColor property should be persisted.

ShouldSerializeCaptionForeColor() : bool

Gets a value indicating whether the DataGrid.CaptionForeColor property should be persisted.

ShouldSerializeGridLineColor() : bool

Indicates whether the DataGrid.GridLineColor property should be persisted.

ShouldSerializeHeaderBackColor() : bool

Indicates whether the DataGrid.HeaderBackColor property should be persisted.

ShouldSerializeHeaderFont() : bool

Indicates whether the DataGrid.HeaderFont property should be persisted.

ShouldSerializeHeaderForeColor() : bool

Indicates whether the DataGrid.HeaderForeColor property should be persisted.

ShouldSerializeLinkHoverColor() : bool

Indicates whether the DataGrid.LinkHoverColor property should be persisted.

ShouldSerializeParentRowsBackColor() : bool

Indicates whether the DataGrid.ParentRowsBackColor property should be persisted.

ShouldSerializeParentRowsForeColor() : bool

Indicates whether the DataGrid.ParentRowsForeColor property should be persisted.

ShouldSerializePreferredRowHeight() : bool

Indicates whether the DataGrid.PreferredRowHeight property should be persisted.

ShouldSerializeSelectionBackColor() : bool

Indicates whether the DataGrid.SelectionBackColor property should be persisted.

ShouldSerializeSelectionForeColor() : bool

Indicates whether the DataGrid.SelectionForeColor property should be persisted.

Public Events

AllowNavigationChanged

Occurs when the DataGrid.AllowNavigation property has changed.

BackButtonClick

Occurs when the Back button on a child table is clicked.

BackgroundColorChanged

Occurs when the DataGrid.BackgroundColor has changed.

BackgroundImageChanged

Occurs when the value of the DataGrid.BackgroundImage property changes.

BackgroundImageLayoutChanged

Occurs when the value of the DataGrid.BackgroundImageLayout property changes.

BorderStyleChanged

Occurs when the DataGrid.BorderStyle has changed.

CaptionVisibleChanged

Occurs when the DataGrid.CaptionVisible property has changed.

CurrentCellChanged

Occurs when the DataGrid.CurrentCell property has changed.

CursorChanged

Occurs when the value of the DataGrid.Cursor property changes.

DataSourceChanged

Occurs when the DataGrid.DataSource property value has changed.

FlatModeChanged

Occurs when the DataGrid.FlatMode has changed.

Navigate

Occurs when the user navigates to a new table.

ParentRowsLabelStyleChanged

Occurs when the label style of the parent row is changed.

ParentRowsVisibleChanged

Occurs when the DataGrid.ParentRowsVisible property value changes.

ReadOnlyChanged

Occurs when the DataGrid.ReadOnly property value changes.

Scroll

Occurs when the user scrolls the System.Windows.Forms.DataGrid control.

ShowParentDetailsButtonClick

Occurs when the ShowParentDetails button is clicked.

TextChanged

Occurs when the value of the DataGrid.Text property changes.

Protected Events

RowHeaderClick

Occurs when a row header is clicked.