我正在使用 datagridview 上的一行中的值来构建图像路径以传递给图片框。
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
DataGridViewRow currentRow = new DataGridViewRow();
currentRow = dataGridView1.CurrentRow;
string valueJob = currentRow.Cells[2].Value.ToString();
string valueBatch = currentRow.Cells[3].Value.ToString();
string valueImmagine = currentRow.Cells[4].Value.ToString();
string result = Octopus2.Properties.Settings.Default.DataPath + "\\" + valueJob + "\\" + valueBatch + "\\" + valueImmagine + ".jpg";
pictbox.ImageLocation = result;
}
问题是,当我使用另一个控件执行 DataSet.clear() 时,代码返回以下错误:“NullreferenceException 未被用户代码处理”。
提前感谢您,任何帮助将不胜感激。