Skip to main content
A newer version of this page is available. .

DataGridView Methods

A data grid view.
Name Description
BeginUpdate() Locks the grid to prevent its visual updates until the EndUpdate method is called.
ClearColumnAutoFilter(GridColumn) Clears the filter that is set in the auto filter row. To specify the column, pass the column object to the method parameters.
ClearColumnAutoFilter(String) Clears the filter that is set in the auto filter row. To specify the column, pass its underlying field’s name to the method parameters.
ClearColumnFilter(GridColumn) Resets FilterString or FilterExpression applied to the column object passed in the method parameters. The method does not reset a filter set using the Auto Filter Row.
ClearColumnFilter(String) Resets FilterString or FilterExpression applied to the column. To specify the column, pass its underlying field’s name to the method parameters. The method does not reset a filter set using the Auto Filter Row.
ClearFilter() Clears the filter applied to data in the grid.
ClearGrouping() Ungroups data in the grid.
ClearSorting() Clears the sorting applied to the grid.
CloseEditor(Boolean) Closes a cell in-place editor.
CollapseAllGroups(Boolean) Collapses all groups of rows.
CollapseGroupRow(Int32, Boolean) Collapses the specified group of rows.
DeleteRow(Int32) Deletes the specified data row.
EndUpdate() Unlocks the grid after the BeginUpdate method call and forces an immediate visual update.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from Object.
ExpandAllGroups(Boolean) Expands all groups of rows.
ExpandGroupRow(Int32, Boolean) Expands the specified group of rows.
FindRowHandle(Object) Returns the handle of the DataGridView row that corresponds to a data object passed in the parameters.
FindRowHandle(Predicate<Object>) Returns the handle of the first row that matches the specified criteria.
FindRowHandle(String, Object) Searches for the value in the column and returns the handle of the corresponding row.
GetCellDisplayText(Int32, GridColumn) Gets the text displayed within the specified cell.
GetCellDisplayText(Int32, String) Gets the text displayed within the specified cell.
GetCellValue(Int32, GridColumn) Returns the value of the specified data cell.
GetCellValue(Int32, String) Returns the value of the specified data cell.
GetChildRowCount(Int32) Returns the number of data rows in a specific group.
GetChildRowHandle(Int32, Int32) Returns the handle of a row at the specified position within the specified group.
GetGroupDisplayText(Int32) Returns an actual or formatted value displayed in the specified group row (group header).
GetGroupSummaryValue(Int32, GridColumnSummary) Returns a summary value calculated against the specified group of rows.
GetGroupValue(Int32) Returns an actual value displayed in the specified group row (group header).
GetHashCode() Serves as the default hash function. Inherited from Object.
GetParentRowHandle(Int32) Returns the group row handle that identifies the group to which the specified data row belongs.
GetRowHandle(Int32) Returns the handle of the row that corresponds to the specified record in the data source.
GetRowHandleByVisibleIndex(Int32) Returns a row’s handle by its visible index.
GetRowItem(Int32) Returns an object that represents a record in the grid’s underlying data source.
GetRowItemBySourceIndex(Int32) Returns the data source object by its index.
GetRowSourceIndex(Int32) Gets the index of the data source record to which the specified row handle corresponds.
GetRowVisibleIndex(Int32) Returns the row’s position within a DataGridView by its handle.
GetTotalSummaryValue(GridColumnSummary) Returns the value of the specified total summary item.
GetType() Gets the Type of the current instance. Inherited from Object.
GroupBy(GridColumn) Groups data in the grid by the specified column.
GroupBy(String) Groups data in the grid by the specified column.
Initialize() Initializes the DataGridView from XAML.
IsGroupCollapsed(Int32) Indicates whether the specified group row is collapsed.
IsGroupRow(Int32) Checks whether the specified row is a group row.
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from Object.
MergeColumnFilters(CriteriaOperator) Combines the specified filter with the grid’s current filter with the AND operator.
MergeColumnFilters(String) Combines the specified filter with the grid’s current filter with the AND operator.
MoveRow(Int32, Int32, Action)
OpenEditor(Int32, String) Invokes an in-place editor for the specified cell.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
RefreshData() Updates the grid’s data.
RefreshRow(Int32) Refreshes the row specified by its handle.
ScrollToColumn(GridColumn)
ScrollToColumn(Int32)
ScrollToRow(Int32) Scrolls the grid to make the specified row visible.
SetCellValue(Int32, GridColumn, Object) Sets the specified cell’s value.
SetCellValue(Int32, String, Object) Sets the specified cell’s value.
SortBy(GridColumn, DataSortOrder, Int32) Sorts data by values of the specified column in the specified order, and places the column at the specified position among the sorted columns.
SortBy(String, DataSortOrder, Int32) Sorts data by values of the specified column in the specified order, and places the column at the specified position among the sorted columns.
ToString() Returns a string that represents the current object. Inherited from Object.
See Also