PictureBox로 전달할 이미지 경로를 작성하기 위해 DataGridview에서 행의 값을 사용하고 있습니다. 내가 다른 컨트롤을 사용) (A DataSet.clear을 수행 할 때DataSet.clear()에서 NullreferenceException 문제가 발생했습니다.
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;
}
문제는 코드는 다음과 같은 오류를 반환한다 : "NullReferenceException이 사용자 코드에 의해 처리되지 않은되었다".
감사합니다. 도움을 주시면 감사하겠습니다.
이 코드는 Exception 또는 Clear()를 발생 시키나요? –
"DataSet.clear()"와 코드 사이의 링크는 무엇입니까? –
[NullReferenceException은 무엇이며 어떻게 수정합니까?] 가능한 복제본 (http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Nasreddine