I'm using values from a row on a datagridview, to build an image path to pass to a picturebox.
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;
}
The problem is, when i do a DataSet.clear() using another control, the code returns the following error: "NullreferenceException was unhandled by user code".
Thank you in advance, any help will be appreciated.