我试图让在GridView的编辑的单元格的单元格值。有人可以用我的语法来帮助我吗?此代码适用于在GridView的第一行:gridview的编辑细胞VB
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.
这是因为它是空的......你想什么...设置断点转换,看看你会得到什么了变量...使用CTYPE投作为一个整数太 – Codexer
它不应该是空的。它有一个价值。 – iDev
变化。文本到您的变量 – Codexer