0
콤보 상자 열이 포함 된 Winforms DataGridView가 있습니다. gridview는 프로그래밍 방식으로 채워지며 시작시 비어 있습니다. "list"는 사용자 정의 객체를 포함하는 목록입니다. Value1/2/3은 각 행마다 고유합니다.DataGridView ComboBoxCell 프로그래밍 방식으로 채우기
int[] array = new[] {value1,value2,value3}
for (int i = 0; i < list.Count; i++)
{
DataRow newrow = MyDataTable.NewRow();
newrow["idColumn"] = list[i].Customer_id;
newrow["dateoforderColumn"] = list[i].Customer_date;
newrow["commColumn"] = list[i].Customer_comment;
// This is what I want, and can't get to work.
newrow["comboColumn"] = array;
// I have also tried (newrow["comboColumn"] as DataGridViewComboColumn).DataSource
// but it didn't work either.
MyDataTable.Rows.Add(newrow);
}
새로 만든 콤보 셀을 어떻게 채울 수 있습니까? 또한 데이터를 얻기 위해 인덱스가 필요하기 때문에 for 루프 내에서이 작업을 수행해야합니다.
포스트의 값을 설정하고 어떻게 데이터 소스 –
열이 디자이너에 추가 설정하고, 유일한 데이터 소스가 데이터 테이블입니다 않는다 프로그래밍 방식으로 생성됩니다. – zergerge