2013-01-17 70 views
0

如上所述。字符串id是一个NULL值,虽然.Value在我调试时不是NULL。将单元格值传递给字符串C#

string id = dataGridView1[columnindex, rowindex].Value.ToString(); 

试图通过改变进.Value.FormattedValue的价值传递到ID,但没有工作过。

+1

这方面的任何例外? –

回答

0
string id = dataGridView1.Rows[rowIndex].Cells[columnIndex].Value.ToString 
0

然后尝试

string id = dataGridView1.Rows[rowIndex].Cells[columnIndex].EditedValueString();