Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGrid Class

 

Displays ADO.NET data in a scrollable grid. The DataGridView control replaces and adds functionality to the DataGrid control; however, the DataGrid control is retained for both backward compatibility and future use, if you choose.

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

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.Control
        System.Windows.Forms.DataGrid

[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComplexBindingPropertiesAttribute("DataSource", "DataMember")]
public class DataGrid : Control, ISupportInitialize, IDataGridEditingService

NameDescription
System_CAPS_pubmethodDataGrid()

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

NameDescription
System_CAPS_pubpropertyAccessibilityObject

Gets the AccessibleObject assigned to the control.(Inherited from Control.)

System_CAPS_pubpropertyAccessibleDefaultActionDescription

Gets or sets the default action description of the control for use by accessibility client applications.(Inherited from Control.)

System_CAPS_pubpropertyAccessibleDescription

Gets or sets the description of the control used by accessibility client applications.(Inherited from Control.)

System_CAPS_pubpropertyAccessibleName

Gets or sets the name of the control used by accessibility client applications.(Inherited from Control.)

System_CAPS_pubpropertyAccessibleRole

Gets or sets the accessible role of the control (Inherited from Control.)

System_CAPS_pubpropertyAllowDrop

Gets or sets a value indicating whether the control can accept data that the user drags onto it.(Inherited from Control.)

System_CAPS_pubpropertyAllowNavigation

Gets or sets a value indicating whether navigation is allowed.

System_CAPS_pubpropertyAllowSorting

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

System_CAPS_pubpropertyAlternatingBackColor

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

System_CAPS_pubpropertyAnchor

Gets 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.)

System_CAPS_pubpropertyAutoScrollOffset

Gets or sets where this control is scrolled to in ScrollControlIntoView.(Inherited from Control.)

System_CAPS_pubpropertyAutoSize

This API supports the product infrastructure and is not intended to be used directly from your code. This property is not relevant for this class.(Inherited from Control.)

System_CAPS_pubpropertyBackColor

Gets or sets the background color of even-numbered rows of the grid.(Overrides Control.BackColor.)

System_CAPS_pubpropertyBackgroundColor

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

System_CAPS_pubpropertyBackgroundImage

This API supports the product infrastructure and is not intended to be used directly from your code. This member is not meaningful for this control.(Overrides Control.BackgroundImage.)

System_CAPS_pubpropertyBackgroundImageLayout

This API supports the product infrastructure and is not intended to be used directly from your code. This member is not meaningful for this control.(Overrides Control.BackgroundImageLayout.)

System_CAPS_pubpropertyBindingContext

Gets or sets the BindingContext for the control.(Inherited from Control.)

System_CAPS_pubpropertyBorderStyle

Gets or sets the grid's border style.

System_CAPS_pubpropertyBottom

Gets the distance, in pixels, between the bottom edge of the control and the top edge of its container's client area.(Inherited from Control.)

System_CAPS_pubpropertyBounds

Gets or sets the size and location of the control including its nonclient elements, in pixels, relative to the parent control.(Inherited from Control.)

System_CAPS_protpropertyCanEnableIme

Gets a value indicating whether the ImeMode property can be set to an active value, to enable IME support.(Inherited from Control.)

System_CAPS_pubpropertyCanFocus

Gets a value indicating whether the control can receive focus.(Inherited from Control.)

System_CAPS_protpropertyCanRaiseEvents

Determines if events can be raised on the control.(Inherited from Control.)

System_CAPS_pubpropertyCanSelect

Gets a value indicating whether the control can be selected.(Inherited from Control.)

System_CAPS_pubpropertyCaptionBackColor

Gets or sets the background color of the caption area.

System_CAPS_pubpropertyCaptionFont

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

System_CAPS_pubpropertyCaptionForeColor

Gets or sets the foreground color of the caption area.

System_CAPS_pubpropertyCaptionText

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

System_CAPS_pubpropertyCaptionVisible

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

System_CAPS_pubpropertyCapture

Gets or sets a value indicating whether the control has captured the mouse.(Inherited from Control.)

System_CAPS_pubpropertyCausesValidation

Gets 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.)

System_CAPS_pubpropertyClientRectangle

Gets the rectangle that represents the client area of the control.(Inherited from Control.)

System_CAPS_pubpropertyClientSize

Gets or sets the height and width of the client area of the control.(Inherited from Control.)

System_CAPS_pubpropertyColumnHeadersVisible

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

System_CAPS_pubpropertyCompanyName

Gets the name of the company or creator of the application containing the control.(Inherited from Control.)

System_CAPS_pubpropertyContainer

Gets the IContainer that contains the Component.(Inherited from Component.)

System_CAPS_pubpropertyContainsFocus

Gets a value indicating whether the control, or one of its child controls, currently has the input focus.(Inherited from Control.)

System_CAPS_pubpropertyContextMenu

Gets or sets the shortcut menu associated with the control.(Inherited from Control.)

System_CAPS_pubpropertyContextMenuStrip

Gets or sets the ContextMenuStrip associated with this control.(Inherited from Control.)

System_CAPS_pubpropertyControls

Gets the collection of controls contained within the control.(Inherited from Control.)

System_CAPS_pubpropertyCreated

Gets a value indicating whether the control has been created.(Inherited from Control.)

System_CAPS_protpropertyCreateParams

Gets the required creation parameters when the control handle is created.(Inherited from Control.)

System_CAPS_pubpropertyCurrentCell

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

System_CAPS_pubpropertyCurrentRowIndex

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

System_CAPS_pubpropertyCursor

This API supports the product infrastructure and is not intended to be used directly from your code. This member is not meaningful for this control.(Overrides Control.Cursor.)

System_CAPS_pubpropertyDataBindings

Gets the data bindings for the control.(Inherited from Control.)

System_CAPS_pubpropertyDataMember

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

System_CAPS_pubpropertyDataSource

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

System_CAPS_protpropertyDefaultCursor

Gets or sets the default cursor for the control.(Inherited from Control.)

System_CAPS_protpropertyDefaultImeMode

Gets the default Input Method Editor (IME) mode supported by the control.(Inherited from Control.)

System_CAPS_protpropertyDefaultMargin

Gets the space, in pixels, that is specified by default between controls.(Inherited from Control.)

System_CAPS_protpropertyDefaultMaximumSize

Gets the length and height, in pixels, that is specified as the default maximum size of a control.(Inherited from Control.)

System_CAPS_protpropertyDefaultMinimumSize

Gets the length and height, in pixels, that is specified as the default minimum size of a control.(Inherited from Control.)

System_CAPS_protpropertyDefaultPadding

Gets the internal spacing, in pixels, of the contents of a control.(Inherited from Control.)

System_CAPS_protpropertyDefaultSize

Gets the default size of the control.(Overrides Control.DefaultSize.)

System_CAPS_protpropertyDesignMode

Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component.)

System_CAPS_pubpropertyDisplayRectangle

Gets the rectangle that represents the display area of the control.(Inherited from Control.)

System_CAPS_pubpropertyDisposing

Gets a value indicating whether the base Control class is in the process of disposing.(Inherited from Control.)

System_CAPS_pubpropertyDock

Gets or sets which control borders are docked to its parent control and determines how a control is resized with its parent.(Inherited from Control.)

System_CAPS_protpropertyDoubleBuffered

Gets or sets a value indicating whether this control should redraw its surface using a secondary buffer to reduce or prevent flicker.(Inherited from Control.)

System_CAPS_pubpropertyEnabled

Gets or sets a value indicating whether the control can respond to user interaction.(Inherited from Control.)

System_CAPS_protpropertyEvents

Gets the list of event handlers that are attached to this Component.(Inherited from Component.)

System_CAPS_pubpropertyFirstVisibleColumn

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

System_CAPS_pubpropertyFlatMode

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

System_CAPS_pubpropertyFocused

Gets a value indicating whether the control has input focus.(Inherited from Control.)

System_CAPS_pubpropertyFont

Gets or sets the font of the text displayed by the control.(Inherited from Control.)

System_CAPS_protpropertyFontHeight

Gets or sets the height of the font of the control.(Inherited from Control.)

System_CAPS_pubpropertyForeColor

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

System_CAPS_pubpropertyGridLineColor

Gets or sets the color of the grid lines.

System_CAPS_pubpropertyGridLineStyle

Gets or sets the line style of the grid.

System_CAPS_pubpropertyHandle

Gets the window handle that the control is bound to.(Inherited from Control.)

System_CAPS_pubpropertyHasChildren

Gets a value indicating whether the control contains one or more child controls.(Inherited from Control.)

System_CAPS_pubpropertyHeaderBackColor

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

System_CAPS_pubpropertyHeaderFont

Gets or sets the font used for column headers.

System_CAPS_pubpropertyHeaderForeColor

Gets or sets the foreground color of headers.

System_CAPS_pubpropertyHeight

Gets or sets the height of the control.(Inherited from Control.)

System_CAPS_protpropertyHorizScrollBar

Gets the horizontal scroll bar for the grid.

System_CAPS_pubpropertyImeMode

Gets or sets the Input Method Editor (IME) mode of the control.(Inherited from Control.)

System_CAPS_protpropertyImeModeBase

Gets or sets the IME mode of a control.(Inherited from Control.)

System_CAPS_pubpropertyInvokeRequired

Gets 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.)

System_CAPS_pubpropertyIsAccessible

Gets or sets a value indicating whether the control is visible to accessibility applications.(Inherited from Control.)

System_CAPS_pubpropertyIsDisposed

Gets a value indicating whether the control has been disposed of.(Inherited from Control.)

System_CAPS_pubpropertyIsHandleCreated

Gets a value indicating whether the control has a handle associated with it.(Inherited from Control.)

System_CAPS_pubpropertyIsMirrored

Gets a value indicating whether the control is mirrored.(Inherited from Control.)

System_CAPS_pubpropertyItem[DataGridCell]

Gets or sets the value of a specified DataGridCell.

System_CAPS_pubpropertyItem[Int32, Int32]

Gets or sets the value of the cell at the specified the row and column.

System_CAPS_pubpropertyLayoutEngine

Gets a cached instance of the control's layout engine.(Inherited from Control.)

System_CAPS_pubpropertyLeft

Gets 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.)

System_CAPS_pubpropertyLinkColor

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

System_CAPS_pubpropertyLinkHoverColor

This API supports the product infrastructure and is not intended to be used directly from your code. This member is not meaningful for this control.

System_CAPS_protpropertyListManager

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

System_CAPS_pubpropertyLocation

Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.(Inherited from Control.)

System_CAPS_pubpropertyMargin

Gets or sets the space between controls.(Inherited from Control.)

System_CAPS_pubpropertyMaximumSize

Gets or sets the size that is the upper limit that GetPreferredSize can specify.(Inherited from Control.)

System_CAPS_pubpropertyMinimumSize

Gets or sets the size that is the lower limit that GetPreferredSize can specify.(Inherited from Control.)

System_CAPS_pubpropertyName

Gets or sets the name of the control.(Inherited from Control.)

System_CAPS_pubpropertyPadding

Gets or sets padding within the control.(Inherited from Control.)

System_CAPS_pubpropertyParent

Gets or sets the parent container of the control.(Inherited from Control.)

System_CAPS_pubpropertyParentRowsBackColor

Gets or sets the background color of parent rows.

System_CAPS_pubpropertyParentRowsForeColor

Gets or sets the foreground color of parent rows.

System_CAPS_pubpropertyParentRowsLabelStyle

Gets or sets the way parent row labels are displayed.

System_CAPS_pubpropertyParentRowsVisible

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

System_CAPS_pubpropertyPreferredColumnWidth

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

System_CAPS_pubpropertyPreferredRowHeight

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

System_CAPS_pubpropertyPreferredSize

Gets the size of a rectangular area into which the control can fit.(Inherited from Control.)

System_CAPS_pubpropertyProductName

Gets the product name of the assembly containing the control.(Inherited from Control.)

System_CAPS_pubpropertyProductVersion

Gets the version of the assembly containing the control.(Inherited from Control.)

System_CAPS_pubpropertyReadOnly

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

System_CAPS_pubpropertyRecreatingHandle

Gets a value indicating whether the control is currently re-creating its handle.(Inherited from Control.)

System_CAPS_pubpropertyRegion

Gets or sets the window region associated with the control.(Inherited from Control.)

System_CAPS_protpropertyRenderRightToLeft

Obsolete.This property is now obsolete.(Inherited from Control.)

System_CAPS_protpropertyResizeRedraw

Gets or sets a value indicating whether the control redraws itself when resized.(Inherited from Control.)

System_CAPS_pubpropertyRight

Gets the distance, in pixels, between the right edge of the control and the left edge of its container's client area.(Inherited from Control.)

System_CAPS_pubpropertyRightToLeft

Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts.(Inherited from Control.)

System_CAPS_pubpropertyRowHeadersVisible

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

System_CAPS_pubpropertyRowHeaderWidth

Gets or sets the width of row headers.

System_CAPS_protpropertyScaleChildren

Gets a value that determines the scaling of child controls. (Inherited from Control.)

System_CAPS_pubpropertySelectionBackColor

Gets or sets the background color of selected rows.

System_CAPS_pubpropertySelectionForeColor

Gets or set the foreground color of selected rows.

System_CAPS_protpropertyShowFocusCues

Gets a value indicating whether the control should display focus rectangles.(Inherited from Control.)

System_CAPS_protpropertyShowKeyboardCues

Gets a value indicating whether the user interface is in the appropriate state to show or hide keyboard accelerators.(Inherited from Control.)

System_CAPS_pubpropertySite

Gets or sets the site of the control.(Overrides Control.Site.)

System_CAPS_pubpropertySize

Gets or sets the height and width of the control.(Inherited from Control.)

System_CAPS_pubpropertyTabIndex

Gets or sets the tab order of the control within its container.(Inherited from Control.)

System_CAPS_pubpropertyTableStyles

Gets the collection of DataGridTableStyle objects for the grid.

System_CAPS_pubpropertyTabStop

Gets or sets a value indicating whether the user can give the focus to this control using the TAB key.(Inherited from Control.)

System_CAPS_pubpropertyTag

Gets or sets the object that contains data about the control.(Inherited from Control.)

System_CAPS_pubpropertyText

This API supports the product infrastructure and is not intended to be used directly from your code. This member is not meaningful for this control.(Overrides Control.Text.)

System_CAPS_pubpropertyTop

Gets 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.)

System_CAPS_pubpropertyTopLevelControl

Gets 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.)

System_CAPS_pubpropertyUseWaitCursor

Gets or sets a value indicating whether to use the wait cursor for the current control and all child controls.(Inherited from Control.)

System_CAPS_protpropertyVertScrollBar

Gets the vertical scroll bar of the control.

System_CAPS_pubpropertyVisible

Gets or sets a value indicating whether the control and all its child controls are displayed.(Inherited from Control.)

System_CAPS_pubpropertyVisibleColumnCount

Gets the number of visible columns.

System_CAPS_pubpropertyVisibleRowCount

Gets the number of rows visible.

System_CAPS_pubpropertyWidth

Gets or sets the width of the control.(Inherited from Control.)

System_CAPS_pubpropertyWindowTarget

This API supports the product infrastructure and is not intended to be used directly from your code. This property is not relevant for this class.(Inherited from Control.)

NameDescription
System_CAPS_protmethodAccessibilityNotifyClients(AccessibleEvents, Int32)

Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control.(Inherited from Control.)

System_CAPS_protmethodAccessibilityNotifyClients(AccessibleEvents, Int32, Int32)

Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control .(Inherited from Control.)

System_CAPS_pubmethodBeginEdit(DataGridColumnStyle, Int32)

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

System_CAPS_pubmethodBeginInit()

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.

System_CAPS_pubmethodBeginInvoke(Delegate)

Executes the specified delegate asynchronously on the thread that the control's underlying handle was created on.(Inherited from Control.)

System_CAPS_pubmethodBeginInvoke(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.)

System_CAPS_pubmethodBringToFront()

Brings the control to the front of the z-order.(Inherited from Control.)

System_CAPS_protmethodCancelEditing()

Cancels the current edit operation and rolls back all changes.

System_CAPS_pubmethodCollapse(Int32)

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

System_CAPS_protmethodColumnStartedEditing(Control)

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

System_CAPS_protmethodColumnStartedEditing(Rectangle)

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

System_CAPS_pubmethodContains(Control)

Retrieves a value indicating whether the specified control is a child of the control.(Inherited from Control.)

System_CAPS_protmethodCreateAccessibilityInstance()

Constructs a new instance of the accessibility object for this control.(Overrides Control.CreateAccessibilityInstance().)

System_CAPS_pubmethodCreateControl()

Forces the creation of the visible control, including the creation of the handle and any visible child controls.(Inherited from Control.)

System_CAPS_protmethodCreateControlsInstance()

Creates a new instance of the control collection for the control.(Inherited from Control.)

System_CAPS_pubmethodCreateGraphics()

Creates the Graphics for the control.(Inherited from Control.)

System_CAPS_protmethodCreateGridColumn(PropertyDescriptor)

Creates a new DataGridColumnStyle with the specified PropertyDescriptor.

System_CAPS_protmethodCreateGridColumn(PropertyDescriptor, Boolean)

Creates a DataGridColumnStyle using the specified PropertyDescriptor.

System_CAPS_protmethodCreateHandle()

Creates a handle for the control.(Inherited from Control.)

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodDefWndProc(Message)

Sends the specified message to the default window procedure.(Inherited from Control.)

System_CAPS_protmethodDestroyHandle()

Destroys the handle associated with the control.(Inherited from Control.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Component.(Inherited from Component.)

System_CAPS_protmethodDispose(Boolean)

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

System_CAPS_pubmethodDoDragDrop(Object, DragDropEffects)

Begins a drag-and-drop operation.(Inherited from Control.)

System_CAPS_pubmethodDrawToBitmap(Bitmap, Rectangle)

Supports rendering to the specified bitmap.(Inherited from Control.)

System_CAPS_pubmethodEndEdit(DataGridColumnStyle, Int32, Boolean)

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

System_CAPS_pubmethodEndInit()

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.

System_CAPS_pubmethodEndInvoke(IAsyncResult)

Retrieves the return value of the asynchronous operation represented by the IAsyncResult passed.(Inherited from Control.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodExpand(Int32)

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

System_CAPS_protmethodFinalize()

Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.(Inherited from Component.)

System_CAPS_pubmethodFindForm()

Retrieves the form that the control is on.(Inherited from Control.)

System_CAPS_pubmethodFocus()

Sets input focus to the control.(Inherited from Control.)

System_CAPS_protmethodGetAccessibilityObjectById(Int32)

Retrieves the specified AccessibleObject.(Inherited from Control.)

System_CAPS_protmethodGetAutoSizeMode()

Retrieves a value indicating how a control will behave when its AutoSize property is enabled.(Inherited from Control.)

System_CAPS_pubmethodGetCellBounds(DataGridCell)

Gets the Rectangle of the cell specified by DataGridCell.

System_CAPS_pubmethodGetCellBounds(Int32, Int32)

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

System_CAPS_pubmethodGetChildAtPoint(Point)

Retrieves the child control that is located at the specified coordinates.(Inherited from Control.)

System_CAPS_pubmethodGetChildAtPoint(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.)

System_CAPS_pubmethodGetContainerControl()

Returns the next ContainerControl up the control's chain of parent controls.(Inherited from Control.)

System_CAPS_pubmethodGetCurrentCellBounds()

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

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetNextControl(Control, Boolean)

Retrieves the next control forward or back in the tab order of child controls.(Inherited from Control.)

System_CAPS_protmethodGetOutputTextDelimiter()

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the string that is the delimiter between columns when row contents are copied to the Clipboard.

System_CAPS_pubmethodGetPreferredSize(Size)

Retrieves the size of a rectangular area into which a control can be fitted.(Inherited from Control.)

System_CAPS_protmethodGetScaledBounds(Rectangle, SizeF, BoundsSpecified)

Retrieves the bounds within which the control is scaled.(Inherited from Control.)

System_CAPS_protmethodGetService(Type)

Returns an object that represents a service provided by the Component or by its Container.(Inherited from Component.)

System_CAPS_protmethodGetStyle(ControlStyles)

Retrieves the value of the specified control style bit for the control.(Inherited from Control.)

System_CAPS_protmethodGetTopLevel()

Determines if the control is a top-level control.(Inherited from Control.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodGridHScrolled(Object, ScrollEventArgs)

Listens for the scroll event of the horizontal scroll bar.

System_CAPS_protmethodGridVScrolled(Object, ScrollEventArgs)

Listens for the scroll event of the vertical scroll bar.

System_CAPS_pubmethodHide()

Conceals the control from the user.(Inherited from Control.)

System_CAPS_pubmethodHitTest(Int32, Int32)

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.

System_CAPS_pubmethodHitTest(Point)

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

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodInitLayout()

Called after the control has been added to another container.(Inherited from Control.)

System_CAPS_pubmethodInvalidate()

Invalidates the entire surface of the control and causes the control to be redrawn.(Inherited from Control.)

System_CAPS_pubmethodInvalidate(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.)

System_CAPS_pubmethodInvalidate(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.)

System_CAPS_pubmethodInvalidate(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.)

System_CAPS_pubmethodInvalidate(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.)

System_CAPS_pubmethodInvalidate(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.)

System_CAPS_pubmethodInvoke(Delegate)

Executes the specified delegate on the thread that owns the control's underlying window handle.(Inherited from Control.)

System_CAPS_pubmethodInvoke(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.)

System_CAPS_protmethodInvokeGotFocus(Control, EventArgs)

Raises the GotFocus event for the specified control.(Inherited from Control.)

System_CAPS_protmethodInvokeLostFocus(Control, EventArgs)

Raises the LostFocus event for the specified control.(Inherited from Control.)

System_CAPS_protmethodInvokeOnClick(Control, EventArgs)

Raises the Click event for the specified control.(Inherited from Control.)

System_CAPS_protmethodInvokePaint(Control, PaintEventArgs)

Raises the Paint event for the specified control.(Inherited from Control.)

System_CAPS_protmethodInvokePaintBackground(Control, PaintEventArgs)

Raises the PaintBackground event for the specified control.(Inherited from Control.)

System_CAPS_pubmethodIsExpanded(Int32)

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

System_CAPS_protmethodIsInputChar(Char)

Determines if a character is an input character that the control recognizes.(Inherited from Control.)

System_CAPS_protmethodIsInputKey(Keys)

Determines whether the specified key is a regular input key or a special key that requires preprocessing.(Inherited from Control.)

System_CAPS_pubmethodIsSelected(Int32)

Gets a value indicating whether a specified row is selected.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodNavigateBack()

Navigates back to the table previously displayed in the grid.

System_CAPS_pubmethodNavigateTo(Int32, String)

Navigates to the table specified by row and relation name.

System_CAPS_protmethodNotifyInvalidate(Rectangle)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the Invalidated event with a specified region of the control to invalidate.(Inherited from Control.)

System_CAPS_protmethodOnAllowNavigationChanged(EventArgs)

Raises the AllowNavigationChanged event.

System_CAPS_protmethodOnAutoSizeChanged(EventArgs)

Raises the AutoSizeChanged event. (Inherited from Control.)

System_CAPS_protmethodOnBackButtonClicked(Object, EventArgs)

Listens for the caption's back button clicked event.

System_CAPS_protmethodOnBackColorChanged(EventArgs)
System_CAPS_protmethodOnBackgroundColorChanged(EventArgs)

Raises the BackgroundColorChanged event.

System_CAPS_protmethodOnBackgroundImageChanged(EventArgs)

Raises the BackgroundImageChanged event.(Inherited from Control.)

System_CAPS_protmethodOnBackgroundImageLayoutChanged(EventArgs)

Raises the BackgroundImageLayoutChanged event.(Inherited from Control.)

System_CAPS_protmethodOnBindingContextChanged(EventArgs)
System_CAPS_protmethodOnBorderStyleChanged(EventArgs)

Raises the BorderStyleChanged event.

System_CAPS_protmethodOnCaptionVisibleChanged(EventArgs)

Raises the CaptionVisibleChanged event.

System_CAPS_protmethodOnCausesValidationChanged(EventArgs)

Raises the CausesValidationChanged event.(Inherited from Control.)

System_CAPS_protmethodOnChangeUICues(UICuesEventArgs)

Raises the ChangeUICues event.(Inherited from Control.)

System_CAPS_protmethodOnClick(EventArgs)

Raises the Click event.(Inherited from Control.)

System_CAPS_protmethodOnClientSizeChanged(EventArgs)

Raises the ClientSizeChanged event. (Inherited from Control.)

System_CAPS_protmethodOnContextMenuChanged(EventArgs)

Raises the ContextMenuChanged event.(Inherited from Control.)

System_CAPS_protmethodOnContextMenuStripChanged(EventArgs)

Raises the ContextMenuStripChanged event.(Inherited from Control.)

System_CAPS_protmethodOnControlAdded(ControlEventArgs)

Raises the ControlAdded event.(Inherited from Control.)

System_CAPS_protmethodOnControlRemoved(ControlEventArgs)

Raises the ControlRemoved event.(Inherited from Control.)

System_CAPS_protmethodOnCreateControl()

Raises the CreateControl method.(Inherited from Control.)

System_CAPS_protmethodOnCurrentCellChanged(EventArgs)

Raises the CurrentCellChanged event.

System_CAPS_protmethodOnCursorChanged(EventArgs)

Raises the CursorChanged event.(Inherited from Control.)

System_CAPS_protmethodOnDataSourceChanged(EventArgs)

Raises the DataSourceChanged event.

System_CAPS_protmethodOnDockChanged(EventArgs)

Raises the DockChanged event.(Inherited from Control.)

System_CAPS_protmethodOnDoubleClick(EventArgs)

Raises the DoubleClick event.(Inherited from Control.)

System_CAPS_protmethodOnDragDrop(DragEventArgs)

Raises the DragDrop event.(Inherited from Control.)

System_CAPS_protmethodOnDragEnter(DragEventArgs)

Raises the DragEnter event.(Inherited from Control.)

System_CAPS_protmethodOnDragLeave(EventArgs)

Raises the DragLeave event.(Inherited from Control.)

System_CAPS_protmethodOnDragOver(DragEventArgs)

Raises the DragOver event.(Inherited from Control.)

System_CAPS_protmethodOnEnabledChanged(EventArgs)

Raises the EnabledChanged event.(Inherited from Control.)

System_CAPS_protmethodOnEnter(EventArgs)

Raises the Enter event.(Overrides Control.OnEnter(EventArgs).)

System_CAPS_protmethodOnFlatModeChanged(EventArgs)

Raises the FlatModeChanged event.

System_CAPS_protmethodOnFontChanged(EventArgs)

Raises the FontChanged event.(Overrides Control.OnFontChanged(EventArgs).)

System_CAPS_protmethodOnForeColorChanged(EventArgs)
System_CAPS_protmethodOnGiveFeedback(GiveFeedbackEventArgs)

Raises the GiveFeedback event.(Inherited from Control.)

System_CAPS_protmethodOnGotFocus(EventArgs)

Raises the GotFocus event.(Inherited from Control.)

System_CAPS_protmethodOnHandleCreated(EventArgs)

Raises the CreateHandle event.(Overrides Control.OnHandleCreated(EventArgs).)

System_CAPS_protmethodOnHandleDestroyed(EventArgs)
System_CAPS_protmethodOnHelpRequested(HelpEventArgs)

Raises the HelpRequested event.(Inherited from Control.)

System_CAPS_protmethodOnImeModeChanged(EventArgs)

Raises the ImeModeChanged event.(Inherited from Control.)

System_CAPS_protmethodOnInvalidated(InvalidateEventArgs)

Raises the Invalidated event.(Inherited from Control.)

System_CAPS_protmethodOnKeyDown(KeyEventArgs)

Raises the KeyDown event.(Overrides Control.OnKeyDown(KeyEventArgs).)

System_CAPS_protmethodOnKeyPress(KeyPressEventArgs)

Raises the KeyPress event.(Overrides Control.OnKeyPress(KeyPressEventArgs).)

System_CAPS_protmethodOnKeyUp(KeyEventArgs)

Raises the KeyUp event.(Inherited from Control.)

System_CAPS_protmethodOnLayout(LayoutEventArgs)

Raises the Layout event, which repositions controls and updates scroll bars.(Overrides Control.OnLayout(LayoutEventArgs).)

System_CAPS_protmethodOnLeave(EventArgs)

Raises the Leave event.(Overrides Control.OnLeave(EventArgs).)

System_CAPS_protmethodOnLocationChanged(EventArgs)

Raises the LocationChanged event.(Inherited from Control.)

System_CAPS_protmethodOnLostFocus(EventArgs)

Raises the LostFocus event.(Inherited from Control.)

System_CAPS_protmethodOnMarginChanged(EventArgs)

Raises the MarginChanged event. (Inherited from Control.)

System_CAPS_protmethodOnMouseCaptureChanged(EventArgs)

Raises the MouseCaptureChanged event.(Inherited from Control.)

System_CAPS_protmethodOnMouseClick(MouseEventArgs)

Raises the MouseClick event.(Inherited from Control.)

System_CAPS_protmethodOnMouseDoubleClick(MouseEventArgs)

Raises the MouseDoubleClick event.(Inherited from Control.)

System_CAPS_protmethodOnMouseDown(MouseEventArgs)

Raises the MouseDown event.(Overrides Control.OnMouseDown(MouseEventArgs).)

System_CAPS_protmethodOnMouseEnter(EventArgs)

Raises the MouseEnter event.(Inherited from Control.)

System_CAPS_protmethodOnMouseHover(EventArgs)

Raises the MouseHover event.(Inherited from Control.)

System_CAPS_protmethodOnMouseLeave(EventArgs)

Creates the MouseLeave event.(Overrides Control.OnMouseLeave(EventArgs).)

System_CAPS_protmethodOnMouseMove(MouseEventArgs)

Raises the MouseMove event.(Overrides Control.OnMouseMove(MouseEventArgs).)

System_CAPS_protmethodOnMouseUp(MouseEventArgs)

Raises the MouseUp event.(Overrides Control.OnMouseUp(MouseEventArgs).)

System_CAPS_protmethodOnMouseWheel(MouseEventArgs)

Raises the MouseWheel event.(Overrides Control.OnMouseWheel(MouseEventArgs).)

System_CAPS_protmethodOnMove(EventArgs)

Raises the Move event.(Inherited from Control.)

System_CAPS_protmethodOnNavigate(NavigateEventArgs)

Raises the Navigate event.

System_CAPS_protmethodOnNotifyMessage(Message)

Notifies the control of Windows messages.(Inherited from Control.)

System_CAPS_protmethodOnPaddingChanged(EventArgs)

Raises the PaddingChanged event.(Inherited from Control.)

System_CAPS_protmethodOnPaint(PaintEventArgs)

Raises the Paint event.(Overrides Control.OnPaint(PaintEventArgs).)

System_CAPS_protmethodOnPaintBackground(PaintEventArgs)

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

System_CAPS_protmethodOnParentBackColorChanged(EventArgs)

Raises the BackColorChanged event when the BackColor property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnParentBackgroundImageChanged(EventArgs)

Raises the BackgroundImageChanged event when the BackgroundImage property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnParentBindingContextChanged(EventArgs)

Raises the BindingContextChanged event when the BindingContext property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnParentChanged(EventArgs)

Raises the ParentChanged event.(Inherited from Control.)

System_CAPS_protmethodOnParentCursorChanged(EventArgs)

Raises the CursorChanged event.(Inherited from Control.)

System_CAPS_protmethodOnParentEnabledChanged(EventArgs)

Raises the EnabledChanged event when the Enabled property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnParentFontChanged(EventArgs)

Raises the FontChanged event when the Font property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnParentForeColorChanged(EventArgs)

Raises the ForeColorChanged event when the ForeColor property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnParentRightToLeftChanged(EventArgs)

Raises the RightToLeftChanged event when the RightToLeft property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnParentRowsLabelStyleChanged(EventArgs)

Raises the ParentRowsLabelStyleChanged event.

System_CAPS_protmethodOnParentRowsVisibleChanged(EventArgs)

Raises the ParentRowsVisibleChanged event.

System_CAPS_protmethodOnParentVisibleChanged(EventArgs)

Raises the VisibleChanged event when the Visible property value of the control's container changes.(Inherited from Control.)

System_CAPS_protmethodOnPreviewKeyDown(PreviewKeyDownEventArgs)

Raises the PreviewKeyDown event.(Inherited from Control.)

System_CAPS_protmethodOnPrint(PaintEventArgs)

Raises the Paint event. (Inherited from Control.)

System_CAPS_protmethodOnQueryContinueDrag(QueryContinueDragEventArgs)

Raises the QueryContinueDrag event.(Inherited from Control.)

System_CAPS_protmethodOnReadOnlyChanged(EventArgs)

Raises the ReadOnlyChanged event

System_CAPS_protmethodOnRegionChanged(EventArgs)

Raises the RegionChanged event. (Inherited from Control.)

System_CAPS_protmethodOnResize(EventArgs)

Raises the Resize event.(Overrides Control.OnResize(EventArgs).)

System_CAPS_protmethodOnRightToLeftChanged(EventArgs)

Raises the RightToLeftChanged event.(Inherited from Control.)

System_CAPS_protmethodOnRowHeaderClick(EventArgs)

Raises the RowHeaderClick event.

System_CAPS_protmethodOnScroll(EventArgs)

Raises the Scroll event.

System_CAPS_protmethodOnShowParentDetailsButtonClicked(Object, EventArgs)
System_CAPS_protmethodOnSizeChanged(EventArgs)

Raises the SizeChanged event.(Inherited from Control.)

System_CAPS_protmethodOnStyleChanged(EventArgs)

Raises the StyleChanged event.(Inherited from Control.)

System_CAPS_protmethodOnSystemColorsChanged(EventArgs)

Raises the SystemColorsChanged event.(Inherited from Control.)

System_CAPS_protmethodOnTabIndexChanged(EventArgs)

Raises the TabIndexChanged event.(Inherited from Control.)

System_CAPS_protmethodOnTabStopChanged(EventArgs)

Raises the TabStopChanged event.(Inherited from Control.)

System_CAPS_protmethodOnTextChanged(EventArgs)

Raises the TextChanged event.(Inherited from Control.)

System_CAPS_protmethodOnValidated(EventArgs)

Raises the Validated event.(Inherited from Control.)

System_CAPS_protmethodOnValidating(CancelEventArgs)

Raises the Validating event.(Inherited from Control.)

System_CAPS_protmethodOnVisibleChanged(EventArgs)

Raises the VisibleChanged event.(Inherited from Control.)

System_CAPS_pubmethodPerformLayout()

Forces the control to apply layout logic to all its child controls.(Inherited from Control.)

System_CAPS_pubmethodPerformLayout(Control, String)

Forces the control to apply layout logic to all its child controls.(Inherited from Control.)

System_CAPS_pubmethodPointToClient(Point)

Computes the location of the specified screen point into client coordinates.(Inherited from Control.)

System_CAPS_pubmethodPointToScreen(Point)

Computes the location of the specified client point into screen coordinates.(Inherited from Control.)

System_CAPS_pubmethodPreProcessControlMessage(Message)

Preprocesses keyboard or input messages within the message loop before they are dispatched.(Inherited from Control.)

System_CAPS_pubmethodPreProcessMessage(Message)

Preprocesses keyboard or input messages within the message loop before they are dispatched.(Inherited from Control.)

System_CAPS_protmethodProcessCmdKey(Message, Keys)

Processes a command key.(Inherited from Control.)

System_CAPS_protmethodProcessDialogChar(Char)

Processes a dialog character.(Inherited from Control.)

System_CAPS_protmethodProcessDialogKey(Keys)

Gets or sets a value that indicates whether a key should be processed further.(Overrides Control.ProcessDialogKey(Keys).)

System_CAPS_protmethodProcessGridKey(KeyEventArgs)

Processes keys for grid navigation.

System_CAPS_protmethodProcessKeyEventArgs(Message)

Processes a key message and generates the appropriate control events.(Inherited from Control.)

System_CAPS_protmethodProcessKeyMessage(Message)

Processes a keyboard message.(Inherited from Control.)

System_CAPS_protmethodProcessKeyPreview(Message)

Previews a keyboard message and returns a value indicating if the key was consumed.(Overrides Control.ProcessKeyPreview(Message).)

System_CAPS_protmethodProcessMnemonic(Char)

Processes a mnemonic character.(Inherited from Control.)

System_CAPS_protmethodProcessTabKey(Keys)

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

System_CAPS_protmethodRaiseDragEvent(Object, DragEventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the appropriate drag event.(Inherited from Control.)

System_CAPS_protmethodRaiseKeyEvent(Object, KeyEventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the appropriate key event.(Inherited from Control.)

System_CAPS_protmethodRaiseMouseEvent(Object, MouseEventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the appropriate mouse event.(Inherited from Control.)

System_CAPS_protmethodRaisePaintEvent(Object, PaintEventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the appropriate paint event.(Inherited from Control.)

System_CAPS_protmethodRecreateHandle()

Forces the re-creation of the handle for the control.(Inherited from Control.)

System_CAPS_pubmethodRectangleToClient(Rectangle)

Computes the size and location of the specified screen rectangle in client coordinates.(Inherited from Control.)

System_CAPS_pubmethodRectangleToScreen(Rectangle)

Computes the size and location of the specified client rectangle in screen coordinates.(Inherited from Control.)

System_CAPS_pubmethodRefresh()

Forces the control to invalidate its client area and immediately redraw itself and any child controls.(Inherited from Control.)

System_CAPS_pubmethodResetAlternatingBackColor()

Resets the AlternatingBackColor property to its default color.

System_CAPS_pubmethodResetBackColor()

Resets the BackColor property to its default value.(Overrides Control.ResetBackColor().)

System_CAPS_pubmethodResetBindings()

Causes a control bound to the BindingSource to reread all the items in the list and refresh their displayed values.(Inherited from Control.)

System_CAPS_pubmethodResetCursor()

Resets the Cursor property to its default value.(Inherited from Control.)

System_CAPS_pubmethodResetFont()

Resets the Font property to its default value.(Inherited from Control.)

System_CAPS_pubmethodResetForeColor()

Resets the ForeColor property to its default value.(Overrides Control.ResetForeColor().)

System_CAPS_pubmethodResetGridLineColor()

Resets the GridLineColor property to its default value.

System_CAPS_pubmethodResetHeaderBackColor()

Resets the HeaderBackColor property to its default value.

System_CAPS_pubmethodResetHeaderFont()

Resets the HeaderFont property to its default value.

System_CAPS_pubmethodResetHeaderForeColor()

Resets the HeaderForeColor property to its default value.

System_CAPS_pubmethodResetImeMode()

Resets the ImeMode property to its default value.(Inherited from Control.)

System_CAPS_pubmethodResetLinkColor()

Resets the LinkColor property to its default value.

System_CAPS_pubmethodResetLinkHoverColor()

Resets the LinkHoverColor property to its default value.

System_CAPS_protmethodResetMouseEventArgs()

This API supports the product infrastructure and is not intended to be used directly from your code. Resets the control to handle the MouseLeave event.(Inherited from Control.)

System_CAPS_pubmethodResetRightToLeft()

Resets the RightToLeft property to its default value.(Inherited from Control.)

System_CAPS_protmethodResetSelection()

Turns off selection for all rows that are selected.

System_CAPS_pubmethodResetSelectionBackColor()

Resets the SelectionBackColor property to its default value.

System_CAPS_pubmethodResetSelectionForeColor()

Resets the SelectionForeColor property to its default value.

System_CAPS_pubmethodResetText()

Resets the Text property to its default value.(Inherited from Control.)

System_CAPS_pubmethodResumeLayout()

Resumes usual layout logic.(Inherited from Control.)

System_CAPS_pubmethodResumeLayout(Boolean)

Resumes usual layout logic, optionally forcing an immediate layout of pending layout requests.(Inherited from Control.)

System_CAPS_protmethodRtlTranslateAlignment(ContentAlignment)

Converts the specified ContentAlignment to the appropriate ContentAlignment to support right-to-left text.(Inherited from Control.)

System_CAPS_protmethodRtlTranslateAlignment(HorizontalAlignment)

Converts the specified HorizontalAlignment to the appropriate HorizontalAlignment to support right-to-left text.(Inherited from Control.)

System_CAPS_protmethodRtlTranslateAlignment(LeftRightAlignment)

Converts the specified LeftRightAlignment to the appropriate LeftRightAlignment to support right-to-left text.(Inherited from Control.)

System_CAPS_protmethodRtlTranslateContent(ContentAlignment)

Converts the specified ContentAlignment to the appropriate ContentAlignment to support right-to-left text.(Inherited from Control.)

System_CAPS_protmethodRtlTranslateHorizontal(HorizontalAlignment)

Converts the specified HorizontalAlignment to the appropriate HorizontalAlignment to support right-to-left text.(Inherited from Control.)

System_CAPS_protmethodRtlTranslateLeftRight(LeftRightAlignment)

Converts the specified LeftRightAlignment to the appropriate LeftRightAlignment to support right-to-left text.(Inherited from Control.)

System_CAPS_pubmethodScale(Single)

Obsolete.Scales the control and any child controls.(Inherited from Control.)

System_CAPS_pubmethodScale(Single, Single)

Obsolete.Scales the entire control and any child controls.(Inherited from Control.)

System_CAPS_pubmethodScale(SizeF)

Scales the control and all child controls by the specified scaling factor.(Inherited from Control.)

System_CAPS_protmethodScaleControl(SizeF, BoundsSpecified)

Scales a control's location, size, padding and margin.(Inherited from Control.)

System_CAPS_protmethodScaleCore(Single, Single)

This API supports the product infrastructure and is not intended to be used directly from your code. This method is not relevant for this class.(Inherited from Control.)

System_CAPS_pubmethodSelect()

Activates the control.(Inherited from Control.)

System_CAPS_protmethodSelect(Boolean, Boolean)

Activates a child control. Optionally specifies the direction in the tab order to select the control from.(Inherited from Control.)

System_CAPS_pubmethodSelect(Int32)

Selects a specified row.

System_CAPS_pubmethodSelectNextControl(Control, Boolean, Boolean, Boolean, Boolean)

Activates the next control.(Inherited from Control.)

System_CAPS_pubmethodSendToBack()

Sends the control to the back of the z-order.(Inherited from Control.)

System_CAPS_protmethodSetAutoSizeMode(AutoSizeMode)

Sets a value indicating how a control will behave when its AutoSize property is enabled.(Inherited from Control.)

System_CAPS_pubmethodSetBounds(Int32, Int32, Int32, Int32)

Sets the bounds of the control to the specified location and size.(Inherited from Control.)

System_CAPS_pubmethodSetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)

Sets the specified bounds of the control to the specified location and size.(Inherited from Control.)

System_CAPS_protmethodSetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)

Performs the work of setting the specified bounds of this control.(Inherited from Control.)

System_CAPS_protmethodSetClientSizeCore(Int32, Int32)

Sets the size of the client area of the control.(Inherited from Control.)

System_CAPS_pubmethodSetDataBinding(Object, String)

Sets the DataSource and DataMember properties at run time.

System_CAPS_protmethodSetStyle(ControlStyles, Boolean)

Sets a specified ControlStyles flag to either true or false.(Inherited from Control.)

System_CAPS_protmethodSetTopLevel(Boolean)

Sets the control as the top-level control.(Inherited from Control.)

System_CAPS_protmethodSetVisibleCore(Boolean)

Sets the control to the specified visible state.(Inherited from Control.)

System_CAPS_protmethodShouldSerializeAlternatingBackColor()

Indicates whether the AlternatingBackColor property should be persisted.

System_CAPS_protmethodShouldSerializeBackgroundColor()

Indicates whether the BackgroundColor property should be persisted.

System_CAPS_protmethodShouldSerializeCaptionBackColor()

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

System_CAPS_protmethodShouldSerializeCaptionForeColor()

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

System_CAPS_protmethodShouldSerializeGridLineColor()

Indicates whether the GridLineColor property should be persisted.

System_CAPS_protmethodShouldSerializeHeaderBackColor()

Indicates whether the HeaderBackColor property should be persisted.

System_CAPS_protmethodShouldSerializeHeaderFont()

Indicates whether the HeaderFont property should be persisted.

System_CAPS_protmethodShouldSerializeHeaderForeColor()

Indicates whether the HeaderForeColor property should be persisted.

System_CAPS_protmethodShouldSerializeLinkHoverColor()

Indicates whether the LinkHoverColor property should be persisted.

System_CAPS_protmethodShouldSerializeParentRowsBackColor()

Indicates whether the ParentRowsBackColor property should be persisted.

System_CAPS_protmethodShouldSerializeParentRowsForeColor()

Indicates whether the ParentRowsForeColor property should be persisted.

System_CAPS_protmethodShouldSerializePreferredRowHeight()

Indicates whether the PreferredRowHeight property should be persisted.

System_CAPS_protmethodShouldSerializeSelectionBackColor()

Indicates whether the SelectionBackColor property should be persisted.

System_CAPS_protmethodShouldSerializeSelectionForeColor()

Indicates whether the SelectionForeColor property should be persisted.

System_CAPS_pubmethodShow()

Displays the control to the user.(Inherited from Control.)

System_CAPS_protmethodSizeFromClientSize(Size)

Determines the size of the entire control from the height and width of its client area.(Inherited from Control.)

System_CAPS_pubmethodSubObjectsSiteChange(Boolean)

This API supports the product infrastructure and is not intended to be used directly from your code. Adds or removes the DataGridTableStyle objects from the container that is associated with the DataGrid.

System_CAPS_pubmethodSuspendLayout()

Temporarily suspends the layout logic for the control.(Inherited from Control.)

System_CAPS_pubmethodToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.(Inherited from Component.)

System_CAPS_pubmethodUnSelect(Int32)

Unselects a specified row.

System_CAPS_pubmethodUpdate()

Causes the control to redraw the invalidated regions within its client area.(Inherited from Control.)

System_CAPS_protmethodUpdateBounds()

Updates the bounds of the control with the current size and location.(Inherited from Control.)

System_CAPS_protmethodUpdateBounds(Int32, Int32, Int32, Int32)

Updates the bounds of the control with the specified size and location.(Inherited from Control.)

System_CAPS_protmethodUpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)

Updates the bounds of the control with the specified size, location, and client size.(Inherited from Control.)

System_CAPS_protmethodUpdateStyles()

Forces the assigned styles to be reapplied to the control.(Inherited from Control.)

System_CAPS_protmethodUpdateZOrder()

Updates the control in its parent's z-order.(Inherited from Control.)

System_CAPS_protmethodWndProc(Message)

Processes Windows messages.(Inherited from Control.)

NameDescription
System_CAPS_pubeventAllowNavigationChanged

Occurs when the AllowNavigation property has changed.

System_CAPS_pubeventAutoSizeChanged

This API supports the product infrastructure and is not intended to be used directly from your code. This event is not relevant for this class.(Inherited from Control.)

System_CAPS_pubeventBackButtonClick

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

System_CAPS_pubeventBackColorChanged

Occurs when the value of the BackColor property changes.(Inherited from Control.)

System_CAPS_pubeventBackgroundColorChanged

Occurs when the BackgroundColor has changed.

System_CAPS_pubeventBackgroundImageChanged

This API supports the product infrastructure and is not intended to be used directly from your code. Occurs when the value of the BackgroundImage property changes.

System_CAPS_pubeventBackgroundImageLayoutChanged

This API supports the product infrastructure and is not intended to be used directly from your code. Occurs when the value of the BackgroundImageLayout property changes.

System_CAPS_pubeventBindingContextChanged

Occurs when the value of the BindingContext property changes.(Inherited from Control.)

System_CAPS_pubeventBorderStyleChanged

Occurs when the BorderStyle has changed.

System_CAPS_pubeventCaptionVisibleChanged

Occurs when the CaptionVisible property has changed.

System_CAPS_pubeventCausesValidationChanged

Occurs when the value of the CausesValidation property changes.(Inherited from Control.)

System_CAPS_pubeventChangeUICues

Occurs when the focus or keyboard user interface (UI) cues change.(Inherited from Control.)

System_CAPS_pubeventClick

Occurs when the control is clicked.(Inherited from Control.)

System_CAPS_pubeventClientSizeChanged

Occurs when the value of the ClientSize property changes. (Inherited from Control.)

System_CAPS_pubeventContextMenuChanged

Occurs when the value of the ContextMenu property changes.(Inherited from Control.)

System_CAPS_pubeventContextMenuStripChanged

Occurs when the value of the ContextMenuStrip property changes. (Inherited from Control.)

System_CAPS_pubeventControlAdded

Occurs when a new control is added to the Control.ControlCollection.(Inherited from Control.)

System_CAPS_pubeventControlRemoved

Occurs when a control is removed from the Control.ControlCollection.(Inherited from Control.)

System_CAPS_pubeventCurrentCellChanged

Occurs when the CurrentCell property has changed.

System_CAPS_pubeventCursorChanged

This API supports the product infrastructure and is not intended to be used directly from your code. Occurs when the value of the Cursor property changes.

System_CAPS_pubeventDataSourceChanged

Occurs when the DataSource property value has changed.

System_CAPS_pubeventDisposed

Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)

System_CAPS_pubeventDockChanged

Occurs when the value of the Dock property changes.(Inherited from Control.)

System_CAPS_pubeventDoubleClick

Occurs when the control is double-clicked.(Inherited from Control.)

System_CAPS_pubeventDragDrop

Occurs when a drag-and-drop operation is completed.(Inherited from Control.)

System_CAPS_pubeventDragEnter

Occurs when an object is dragged into the control's bounds.(Inherited from Control.)

System_CAPS_pubeventDragLeave

Occurs when an object is dragged out of the control's bounds.(Inherited from Control.)

System_CAPS_pubeventDragOver

Occurs when an object is dragged over the control's bounds.(Inherited from Control.)

System_CAPS_pubeventEnabledChanged

Occurs when the Enabled property value has changed.(Inherited from Control.)

System_CAPS_pubeventEnter

Occurs when the control is entered.(Inherited from Control.)

System_CAPS_pubeventFlatModeChanged

Occurs when the FlatMode has changed.

System_CAPS_pubeventFontChanged

Occurs when the Font property value changes.(Inherited from Control.)

System_CAPS_pubeventForeColorChanged

Occurs when the ForeColor property value changes.(Inherited from Control.)

System_CAPS_pubeventGiveFeedback

Occurs during a drag operation.(Inherited from Control.)

System_CAPS_pubeventGotFocus

Occurs when the control receives focus.(Inherited from Control.)

System_CAPS_pubeventHandleCreated

Occurs when a handle is created for the control.(Inherited from Control.)

System_CAPS_pubeventHandleDestroyed

Occurs when the control's handle is in the process of being destroyed.(Inherited from Control.)

System_CAPS_pubeventHelpRequested

Occurs when the user requests help for a control.(Inherited from Control.)

System_CAPS_pubeventImeModeChanged

Occurs when the ImeMode property has changed.(Inherited from Control.)

System_CAPS_pubeventInvalidated

Occurs when a control's display requires redrawing.(Inherited from Control.)

System_CAPS_pubeventKeyDown

Occurs when a key is pressed while the control has focus.(Inherited from Control.)

System_CAPS_pubeventKeyPress

Occurs when a character. space or backspace key is pressed while the control has focus.(Inherited from Control.)

System_CAPS_pubeventKeyUp

Occurs when a key is released while the control has focus.(Inherited from Control.)

System_CAPS_pubeventLayout

Occurs when a control should reposition its child controls.(Inherited from Control.)

System_CAPS_pubeventLeave

Occurs when the input focus leaves the control.(Inherited from Control.)

System_CAPS_pubeventLocationChanged

Occurs when the Location property value has changed.(Inherited from Control.)

System_CAPS_pubeventLostFocus

Occurs when the control loses focus.(Inherited from Control.)

System_CAPS_pubeventMarginChanged

Occurs when the control's margin changes.(Inherited from Control.)

System_CAPS_pubeventMouseCaptureChanged

Occurs when the control loses mouse capture.(Inherited from Control.)

System_CAPS_pubeventMouseClick

Occurs when the control is clicked by the mouse.(Inherited from Control.)

System_CAPS_pubeventMouseDoubleClick

Occurs when the control is double clicked by the mouse.(Inherited from Control.)

System_CAPS_pubeventMouseDown

Occurs when the mouse pointer is over the control and a mouse button is pressed.(Inherited from Control.)

System_CAPS_pubeventMouseEnter

Occurs when the mouse pointer enters the control.(Inherited from Control.)

System_CAPS_pubeventMouseHover

Occurs when the mouse pointer rests on the control.(Inherited from Control.)

System_CAPS_pubeventMouseLeave

Occurs when the mouse pointer leaves the control.(Inherited from Control.)

System_CAPS_pubeventMouseMove

Occurs when the mouse pointer is moved over the control.(Inherited from Control.)

System_CAPS_pubeventMouseUp

Occurs when the mouse pointer is over the control and a mouse button is released.(Inherited from Control.)

System_CAPS_pubeventMouseWheel

Occurs when the mouse wheel moves while the control has focus.(Inherited from Control.)

System_CAPS_pubeventMove

Occurs when the control is moved.(Inherited from Control.)

System_CAPS_pubeventNavigate

Occurs when the user navigates to a new table.

System_CAPS_pubeventPaddingChanged

Occurs when the control's padding changes.(Inherited from Control.)

System_CAPS_pubeventPaint

Occurs when the control is redrawn.(Inherited from Control.)

System_CAPS_pubeventParentChanged

Occurs when the Parent property value changes.(Inherited from Control.)

System_CAPS_pubeventParentRowsLabelStyleChanged

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

System_CAPS_pubeventParentRowsVisibleChanged

Occurs when the ParentRowsVisible property value changes.

System_CAPS_pubeventPreviewKeyDown

Occurs before the KeyDown event when a key is pressed while focus is on this control.(Inherited from Control.)

System_CAPS_pubeventQueryAccessibilityHelp

Occurs when AccessibleObject is providing help to accessibility applications.(Inherited from Control.)

System_CAPS_pubeventQueryContinueDrag

Occurs 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.)

System_CAPS_pubeventReadOnlyChanged

Occurs when the ReadOnly property value changes.

System_CAPS_pubeventRegionChanged

Occurs when the value of the Region property changes.(Inherited from Control.)

System_CAPS_pubeventResize

Occurs when the control is resized.(Inherited from Control.)

System_CAPS_pubeventRightToLeftChanged

Occurs when the RightToLeft property value changes.(Inherited from Control.)

System_CAPS_proteventRowHeaderClick

Occurs when a row header is clicked.

System_CAPS_pubeventScroll

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

System_CAPS_pubeventShowParentDetailsButtonClick

Occurs when the ShowParentDetails button is clicked.

System_CAPS_pubeventSizeChanged

Occurs when the Size property value changes.(Inherited from Control.)

System_CAPS_pubeventStyleChanged

Occurs when the control style changes.(Inherited from Control.)

System_CAPS_pubeventSystemColorsChanged

Occurs when the system colors change.(Inherited from Control.)

System_CAPS_pubeventTabIndexChanged

Occurs when the TabIndex property value changes.(Inherited from Control.)

System_CAPS_pubeventTabStopChanged

Occurs when the TabStop property value changes.(Inherited from Control.)

System_CAPS_pubeventTextChanged

This API supports the product infrastructure and is not intended to be used directly from your code. Occurs when the value of the Text property changes.

System_CAPS_pubeventValidated

Occurs when the control is finished validating.(Inherited from Control.)

System_CAPS_pubeventValidating

Occurs when the control is validating.(Inherited from Control.)

System_CAPS_pubeventVisibleChanged

Occurs when the Visible property value changes.(Inherited from Control.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIDropTarget.OnDragDrop(DragEventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the DragDrop event.(Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDropTarget.OnDragEnter(DragEventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the DragEnter event.(Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDropTarget.OnDragLeave(EventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the DragLeave event.(Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDropTarget.OnDragOver(DragEventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the DragOver event.(Inherited from Control.)

The System.Windows.Forms.DataGrid displays Web-like links to child tables. You can click on a link to navigate to the child table. When a child table is displayed, a back button appears in the caption that can be clicked to navigate back to the parent table. The data from the parent rows is displayed below the caption and above the column headers. You can hide the parent row information by clicking the button to the right of the back button.

To display a table in the System.Windows.Forms.DataGrid at run time, use the SetDataBinding method to set the DataSource and DataMember properties to a valid data source. The following data sources are valid:

For more information about the DataSet class, see DataSets, DataTables, and DataViews.

You can create a grid that enables users to edit data but prevents them from adding new rows by using a DataView as the data source and setting the AllowNew property to false.

Data sources are further managed by BindingManagerBase objects. For each table in a data source, a BindingManagerBase can be returned from the form's BindingContext. For example, you can determine the number of rows contained by a data source by returning the associated BindingManagerBase object's Count property.

To validate data, use the underlying objects that represent data and their events. For example, if the data comes from a DataTable in a DataSet, use the ColumnChanging and RowChanging events.

System_CAPS_noteNote

Because the number of columns can be customized (by adding or deleting members of the GridColumnStylesCollection) and the rows can be sorted by column, the RowNumber and ColumnNumber property values cannot be guaranteed to correspond to DataRow and DataColumn indexes in a DataTable. Therefore you should avoid using those properties in the Validating event to validate data.

To determine which cell is selected, use the CurrentCell property. Change the value of any cell by using the Item property, which can take either the row and column indexes of the cell, or a single DataGridCell. Monitor the CurrentCellChanged event to detect when the user selects another cell.

To determine which part of the control the user clicked, use the HitTest method in the MouseDown event. The HitTest method returns a DataGrid.HitTestInfo object, which contains the row and column of a clicked area.

To manage the appearance of the control at run time, several properties for setting the color and caption attributes are available, including the CaptionForeColor, CaptionBackColor, CaptionFont, and so on.

The appearance of the displayed grid (or grids) can be further modified by creating DataGridTableStyle objects and adding them to the GridTableStylesCollection, which is accessed through the TableStyles property. For example, if the DataSource is set to a DataSet containing three DataTable objects, you can add three DataGridTableStyle objects to the collection, one for each table. To synchronize each DataGridTableStyle object with a DataTable, set the MappingName of the DataGridTableStyle to the TableName of the DataTable. For more information about binding to an array of objects, see the DataGridTableStyle.MappingName property.

To create a customized view of a table, create an instance of a DataGridTextBoxColumn or DataGridBoolColumn class and add the object to the GridTableStylesCollection accessed through the TableStyles property. Both classes inherit from DataGridColumnStyle. For each column style, set the MappingName to the ColumnName of a column that you want to show in the grid. To hide a column, set its MappingName to something other than a valid ColumnName.

To format the text of a column, set the Format property of the DataGridTextBoxColumn to one of the values found in Formatting Types in the .NET Framework and Custom Date and Time Format Strings.

To bind the DataGrid to a strongly typed array of objects, the object type must contain public properties. To create a DataGridTableStyle that displays the array, set the DataGridTableStyle.MappingName property to typename[] where typename is replaced by the name of the object type. Also note that the MappingName property is case-sensitive; the type name must be matched exactly. See the MappingName property for an example.

You can also bind the DataGrid to an ArrayList. A feature of the ArrayList is that it can contain objects of multiple types, but the DataGrid can only bind to such a list when all items in the list are of the same type as the first item. This means that all objects must either be of the same type, or they must inherit from the same class as the first item in the list. For example, if the first item in a list is a Control, the second item could be a TextBox (which inherits from Control). If, on the other hand, the first item is a TextBox, the second object cannot be a Control. Further, the ArrayList must have items in it when it is bound. An empty ArrayList will result in an empty grid. In addition, the objects in the ArrayList must contain public properties. When binding to an ArrayList, set the MappingName of the DataGridTableStyle to "ArrayList" (the type name).

For each DataGridTableStyle, you can set color and caption attributes that override the settings for the System.Windows.Forms.DataGrid control. However, if those properties are not set, the settings for the control are used by default. The following properties can be overridden by DataGridTableStyle properties:

To customize the appearance of individual columns, add DataGridColumnStyle objects to the GridColumnStylesCollection, which is accessed through the GridColumnStyles property of each DataGridTableStyle. To synchronize each DataGridColumnStyle with a DataColumn in the DataTable, set the MappingName to the ColumnName of a DataColumn. When constructing a DataGridColumnStyle, you can also set a formatting string that specifies how the column displays data. For example, you can specify that the column use a short-date format to display dates contained in the table.

System_CAPS_cautionCaution

Always create DataGridColumnStyle objects and add them to the GridColumnStylesCollection before adding DataGridTableStyle objects to the GridTableStylesCollection. When you add an empty DataGridTableStyle with a valid MappingName value to the collection, DataGridColumnStyle objects are automatically generated for you. Consequently, an exception will be thrown if you try to add new DataGridColumnStyle objects with duplicate MappingName values to the GridColumnStylesCollection.

System_CAPS_noteNote

The DataGridView control replaces and adds functionality to the DataGrid control; however, 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.

The following code example creates a Windows form, a DataSet containing two DataTable objects, and a DataRelation that relates the two tables. To display the data, a System.Windows.Forms.DataGrid control is then bound to the DataSet through the SetDataBinding method. A button on the form changes the appearance of the grid by creating two DataGridTableStyle objects and setting the MappingName of each object to a TableName of one of the DataTable objects. The example also contains code in the MouseUp event that uses the HitTest method to print the column, row, and part of the grid that has been clicked.

using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
   private System.ComponentModel.Container components;
   private Button button1;
   private Button button2;
   private DataGrid myDataGrid;   
   private DataSet myDataSet;
   private bool TablesAlreadyAdded;
   public Form1()
   {
      // Required for Windows Form Designer support.
      InitializeComponent();
      // Call SetUp to bind the controls.
      SetUp();
   }

   protected override void Dispose( bool disposing ){
      if( disposing ){
         if (components != null){
            components.Dispose();}
      }
      base.Dispose( disposing );
   }
   private void InitializeComponent()
   {
      // Create the form and its controls.
      this.components = new System.ComponentModel.Container();
      this.button1 = new System.Windows.Forms.Button();
      this.button2 = new System.Windows.Forms.Button();
      this.myDataGrid = new DataGrid();

      this.Text = "DataGrid Control Sample";
      this.ClientSize = new System.Drawing.Size(450, 330);

      button1.Location = new Point(24, 16);
      button1.Size = new System.Drawing.Size(120, 24);
      button1.Text = "Change Appearance";
      button1.Click+=new System.EventHandler(button1_Click);

      button2.Location = new Point(150, 16);
      button2.Size = new System.Drawing.Size(120, 24);
      button2.Text = "Get Binding Manager";
      button2.Click+=new System.EventHandler(button2_Click);

      myDataGrid.Location = new  Point(24, 50);
      myDataGrid.Size = new Size(300, 200);
      myDataGrid.CaptionText = "Microsoft DataGrid Control";
      myDataGrid.MouseUp += new MouseEventHandler(Grid_MouseUp);

      this.Controls.Add(button1);
      this.Controls.Add(button2);
      this.Controls.Add(myDataGrid);
   }

   public static void Main()
   {
      Application.Run(new Form1());
   }

   private void SetUp()
   {
      // Create a DataSet with two tables and one relation.
      MakeDataSet();
      /* Bind the DataGrid to the DataSet. The dataMember
      specifies that the Customers table should be displayed.*/
      myDataGrid.SetDataBinding(myDataSet, "Customers");
   }

   private void button1_Click(object sender, System.EventArgs e)
   {
      if(TablesAlreadyAdded) return;
      AddCustomDataTableStyle();
   }

   private void AddCustomDataTableStyle()
   {
      DataGridTableStyle ts1 = new DataGridTableStyle();
      ts1.MappingName = "Customers";
      // Set other properties.
      ts1.AlternatingBackColor = Color.LightGray;

      /* Add a GridColumnStyle and set its MappingName 
      to the name of a DataColumn in the DataTable. 
      Set the HeaderText and Width properties. */

      DataGridColumnStyle boolCol = new DataGridBoolColumn();
      boolCol.MappingName = "Current";
      boolCol.HeaderText = "IsCurrent Customer";
      boolCol.Width = 150;
      ts1.GridColumnStyles.Add(boolCol);

      // Add a second column style.
      DataGridColumnStyle TextCol = new DataGridTextBoxColumn();
      TextCol.MappingName = "custName";
      TextCol.HeaderText = "Customer Name";
      TextCol.Width = 250;
      ts1.GridColumnStyles.Add(TextCol);

      // Create the second table style with columns.
      DataGridTableStyle ts2 = new DataGridTableStyle();
      ts2.MappingName = "Orders";

      // Set other properties.
      ts2.AlternatingBackColor = Color.LightBlue;

      // Create new ColumnStyle objects
      DataGridColumnStyle cOrderDate = 
      new DataGridTextBoxColumn();
      cOrderDate.MappingName = "OrderDate";
      cOrderDate.HeaderText = "Order Date";
      cOrderDate.Width = 100;
      ts2.GridColumnStyles.Add(cOrderDate);

      /* Use a PropertyDescriptor to create a formatted
      column. First get the PropertyDescriptorCollection
      for the data source and data member. */
      PropertyDescriptorCollection pcol = this.BindingContext
      [myDataSet, "Customers.custToOrders"].GetItemProperties();

      /* Create a formatted column using a PropertyDescriptor.
      The formatting character "c" specifies a currency format. */     
      DataGridColumnStyle csOrderAmount = 
      new DataGridTextBoxColumn(pcol["OrderAmount"], "c", true);
      csOrderAmount.MappingName = "OrderAmount";
      csOrderAmount.HeaderText = "Total";
      csOrderAmount.Width = 100;
      ts2.GridColumnStyles.Add(csOrderAmount);

      /* Add the DataGridTableStyle instances to 
      the GridTableStylesCollection. */
      myDataGrid.TableStyles.Add(ts1);
      myDataGrid.TableStyles.Add(ts2);

     // Sets the TablesAlreadyAdded to true so this doesn't happen again.
     TablesAlreadyAdded=true;
   }

   private void button2_Click(object sender, System.EventArgs e)
   {
      BindingManagerBase bmGrid;
      bmGrid = BindingContext[myDataSet, "Customers"];
      MessageBox.Show("Current BindingManager Position: " + bmGrid.Position);
   }

   private void Grid_MouseUp(object sender, MouseEventArgs e)
   {
      // Create a HitTestInfo object using the HitTest method.

      // Get the DataGrid by casting sender.
      DataGrid myGrid = (DataGrid)sender;
      DataGrid.HitTestInfo myHitInfo = myGrid.HitTest(e.X, e.Y);
      Console.WriteLine(myHitInfo);
      Console.WriteLine(myHitInfo.Type);
      Console.WriteLine(myHitInfo.Row);
      Console.WriteLine(myHitInfo.Column);
   }

   // Create a DataSet with two tables and populate it.
   private void MakeDataSet()
   {
      // Create a DataSet.
      myDataSet = new DataSet("myDataSet");

      // Create two DataTables.
      DataTable tCust = new DataTable("Customers");
      DataTable tOrders = new DataTable("Orders");

      // Create two columns, and add them to the first table.
      DataColumn cCustID = new DataColumn("CustID", typeof(int));
      DataColumn cCustName = new DataColumn("CustName");
      DataColumn cCurrent = new DataColumn("Current", typeof(bool));
      tCust.Columns.Add(cCustID);
      tCust.Columns.Add(cCustName);
      tCust.Columns.Add(cCurrent);

      // Create three columns, and add them to the second table.
      DataColumn cID = 
      new DataColumn("CustID", typeof(int));
      DataColumn cOrderDate = 
      new DataColumn("orderDate",typeof(DateTime));
      DataColumn cOrderAmount = 
      new DataColumn("OrderAmount", typeof(decimal));
      tOrders.Columns.Add(cOrderAmount);
      tOrders.Columns.Add(cID);
      tOrders.Columns.Add(cOrderDate);

      // Add the tables to the DataSet.
      myDataSet.Tables.Add(tCust);
      myDataSet.Tables.Add(tOrders);

      // Create a DataRelation, and add it to the DataSet.
      DataRelation dr = new DataRelation
      ("custToOrders", cCustID , cID);
      myDataSet.Relations.Add(dr);

      /* Populates the tables. For each customer and order, 
      creates two DataRow variables. */
      DataRow newRow1;
      DataRow newRow2;

      // Create three customers in the Customers Table.
      for(int i = 1; i < 4; i++)
      {
         newRow1 = tCust.NewRow();
         newRow1["custID"] = i;
         // Add the row to the Customers table.
         tCust.Rows.Add(newRow1);
      }
      // Give each customer a distinct name.
      tCust.Rows[0]["custName"] = "Customer1";
      tCust.Rows[1]["custName"] = "Customer2";
      tCust.Rows[2]["custName"] = "Customer3";

      // Give the Current column a value.
      tCust.Rows[0]["Current"] = true;
      tCust.Rows[1]["Current"] = true;
      tCust.Rows[2]["Current"] = false;

      // For each customer, create five rows in the Orders table.
      for(int i = 1; i < 4; i++)
      {
         for(int j = 1; j < 6; j++)
         {
            newRow2 = tOrders.NewRow();
            newRow2["CustID"]= i;
            newRow2["orderDate"]= new DateTime(2001, i, j * 2);
            newRow2["OrderAmount"] = i * 10 + j  * .1;
            // Add the row to the Orders table.
            tOrders.Rows.Add(newRow2);
         }
      }
   }
}

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: