DataGridView.UpdateCellValue(Int32, Int32) 方法

定义

强制该控件基于它的新值更新在指定位置显示的单元格,并应用当前有效的任何自动调整大小模式。Forces the control to update its display of the cell at the specified location based on its new value, applying any automatic sizing modes currently in effect.

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

参数

columnIndex
Int32

具有新值的单元格的从零开始的列索引。The zero-based column index of the cell with the new value.

rowIndex
Int32

具有新值的单元格的从零开始的行索引。The zero-based row index of the cell with the new value.

异常

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

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

注解

当你在虚拟模式下维护单元格值,并在 CellValuePushed 事件处理程序的外部更新自定义数据缓存中的值时,请使用此方法。Use this method when you maintain cell values in virtual mode and you update a value in your custom data cache outside of a CellValuePushed event handler.

此方法使单元格无效,并强制控件通过 CellValueNeeded 事件处理程序检索新值,并应用有效的任何自动调整大小模式。This method invalidates the cell, forcing the control to retrieve the new value through the CellValueNeeded event handler and apply any automatic sizing modes that are in effect.

适用于

另请参阅