, 나는 그것에 DataGridViewRows
를 삽입하여 수동으로 DataGridView
을 채우기 위해 노력하고있어, 그래서 내 코드는 다음과 같습니다 그러나DataGridViewRow의 셀 값을 열 이름으로 설정하는 방법은 무엇입니까? 창 형태에서
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dgvArticles);
row.Cells[0].Value = product.Id;
row.Cells[1].Value = product.Description;
.
.
.
dgvArticles.Rows.Add(row);
, 나는 열 이름 셀 값을 추가하는 대신 싶습니다 이 같은 인덱스, 무언가에 의해 그 일 :
row.Cells["code"].Value = product.Id;
row.Cells["description"].Value = product.Description;
을하지만, 그런 식으로 일을하는 것은 "코드"라는 이름의 열을 찾을 수 없다는 오류가 발생합니다. 다음과 같이 디자이너의 DataGridView 열을 설정합니다.
잘못된 것이 있습니까? 내가하고 싶은 것을 어떻게 성취 할 수 있습니까?