DataGridViewRowCollection.GetPreviousRow 方法

定义

获取集合中符合指定条件的上一行。Gets the previous row in the collection that meets the specified criteria.

重载

GetPreviousRow(Int32, DataGridViewElementStates)

返回满足指定条件的前一个 DataGridViewRow 的索引。Returns the index of the previous DataGridViewRow that meets the specified criteria.

GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates)

返回满足指定的包含和排除条件的上一个 DataGridViewRow 的索引。Returns the index of the previous DataGridViewRow that meets the specified inclusion and exclusion criteria.

GetPreviousRow(Int32, DataGridViewElementStates)

返回满足指定条件的前一个 DataGridViewRow 的索引。Returns the index of the previous DataGridViewRow that meets the specified criteria.

public:
 int GetPreviousRow(int indexStart, System::Windows::Forms::DataGridViewElementStates includeFilter);
public int GetPreviousRow (int indexStart, System.Windows.Forms.DataGridViewElementStates includeFilter);
member this.GetPreviousRow : int * System.Windows.Forms.DataGridViewElementStates -> int
Public Function GetPreviousRow (indexStart As Integer, includeFilter As DataGridViewElementStates) As Integer

参数

indexStart
Int32

该方法应开始从其中寻找前一个 DataGridViewRow 的行索引。The index of the row where the method should begin to look for the previous DataGridViewRow.

includeFilter
DataGridViewElementStates

DataGridViewElementStates 值的按位组合。A bitwise combination of DataGridViewElementStates values.

返回

具有由 DataGridViewRow 指定的属性的前一个 includeFilter 的索引;如果未找到任何行,则为 -1。The index of the previous DataGridViewRow that has the attributes specified by includeFilter; -1 if no row is found.

异常

indexStart 大于集合中的行数。indexStart is greater than the number of rows in the collection.

includeFilter 不是 DataGridViewElementStates 值的有效按位组合。includeFilter is not a valid bitwise combination of DataGridViewElementStates values.

注解

GetPreviousRow(Int32, DataGridViewElementStates) 方法开始查找匹配条件的行,该条件从 indexStart之前定位的行开始。The GetPreviousRow(Int32, DataGridViewElementStates) method begins looking for the row that matches the criteria starting with the row positioned before indexStart.

另请参阅

GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates)

返回满足指定的包含和排除条件的上一个 DataGridViewRow 的索引。Returns the index of the previous DataGridViewRow that meets the specified inclusion and exclusion criteria.

public:
 int GetPreviousRow(int indexStart, System::Windows::Forms::DataGridViewElementStates includeFilter, System::Windows::Forms::DataGridViewElementStates excludeFilter);
public int GetPreviousRow (int indexStart, System.Windows.Forms.DataGridViewElementStates includeFilter, System.Windows.Forms.DataGridViewElementStates excludeFilter);
member this.GetPreviousRow : int * System.Windows.Forms.DataGridViewElementStates * System.Windows.Forms.DataGridViewElementStates -> int
Public Function GetPreviousRow (indexStart As Integer, includeFilter As DataGridViewElementStates, excludeFilter As DataGridViewElementStates) As Integer

参数

indexStart
Int32

该方法应开始从其中寻找前一个 DataGridViewRow 的行索引。The index of the row where the method should begin to look for the previous DataGridViewRow.

includeFilter
DataGridViewElementStates

DataGridViewElementStates 值的按位组合。A bitwise combination of DataGridViewElementStates values.

excludeFilter
DataGridViewElementStates

DataGridViewElementStates 值的按位组合。A bitwise combination of DataGridViewElementStates values.

返回

是具有 DataGridViewRow 指定的属性,但不具有 includeFilter 指定的属性的上一个 excludeFilter 的索引;如果未找到任何行,则为 -1。The index of the previous DataGridViewRow that has the attributes specified by includeFilter, and does not have the attributes specified by excludeFilter; -1 if no row is found.

异常

indexStart 大于集合中的行数。indexStart is greater than the number of rows in the collection.

一个或两个指定的筛选器值不是有效的 DataGridViewElementStates 值按位组合。One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.

注解

GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates) 方法开始查找匹配条件的行,该条件从 indexStart之前定位的行开始。The GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates) method begins looking for the row that matches the criteria starting with the row positioned before indexStart.

另请参阅

适用于