DataGridView.UpdateCellErrorText(Int32, Int32) 方法

定义

强制指定位置的单元格更新其错误文本。Forces the cell at the specified location to update its error text.

public:
 void UpdateCellErrorText(int columnIndex, int rowIndex);
public void UpdateCellErrorText (int columnIndex, int rowIndex);
member this.UpdateCellErrorText : int * int -> unit
Public Sub UpdateCellErrorText (columnIndex As Integer, rowIndex As Integer)

参数

columnIndex
Int32

要更新的单元格的列索引,或者为 -1(指示行标题单元格)。The column index of the cell to update, or -1 to indicate a row header cell.

rowIndex
Int32

要更新的单元格的行索引,或者为 -1(指示列标题单元格)。The row index of the cell to update, or -1 to indicate a column header cell.

异常

columnIndex 小于 -1 或大于控件中的列数减 1。columnIndex is less than -1 or greater than the number of columns in the control minus 1.

-或--or- rowIndex 小于 -1 或大于控件中的行数减 1。rowIndex is less than -1 or greater than the number of rows in the control minus 1.

注解

当你通过处理 CellErrorTextNeeded 事件自行维护单元格错误文本时,请使用此方法。Use this method when you maintain cell error text yourself by handling the CellErrorTextNeeded event. 更改指定单元格的存储错误文本时,请调用此方法。Call this method when you change the stored error text for the specified cell. 这会使单元格无效,并强制 DataGridView 控件通过 CellErrorTextNeeded 事件处理程序检索更新的错误文本。This will invalidate the cell, forcing the DataGridView control to retrieve the updated error text through the CellErrorTextNeeded event handler.

尽管可以使用此方法来更新标题单元格的错误,但列标题单元格不显示错误标志符号。Although you can use this method to update errors for header cells, column header cells do not display error glyphs.

适用于

另请参阅