我正在尝试获取网格视图中已编辑单元格的单元格值。有人可以帮助我的语法吗?此代码适用于 gridview 中的第一行:
Dim Q As Integer = e.NewValues(e.RowIndex)
但是如果我更新第 2 行,我会收到错误消息......并且我的变量是“”:
Index was out of range. Must be non-negative and less than the size of the collection.
这将打印当前正在编辑的正确行:
System.Diagnostics.Debug.Print(e.RowIndex)
我什至尝试直接获取单元格值:
Dim Qoh As Integer = CInt(gvInventory.Rows(e.RowIndex).Cells(2).Text)
出现错误:
Conversion from string "" to type 'Integer' is not valid.