저는이 일에 대해 대부분 일해 왔으며 해결책은 계속해서 나를 피합니다. 내 Winform 응용 프로그램에 DataGridView
이 포함되어 있는데 열 두 개가 드롭 다운 목록 ComboBox
입니다. 이상하게도 DataGridView
은 올바르게 채워지는 것처럼 보입니다. 그러나 마우스 오버 또는 겉으로는 DataGridVeiw
과 관련된 다른 트리거 가능한 이벤트가있을 때마다 채우거나 때마다 과다한 오류가 발생합니다. 특히 System.ArgumentException
및 System.FormatException
에 대한 두 개의 반복 오류가 발생합니다. 이러한 오류의 모두에 대한 메시지 텍스트는 : 나는 단지 DataError
이벤트를 처리하여이 문제를 마스크하지 않으C# 런타임 오류 : "DataGridViewComboBoxCell 값이 올바르지 않습니다."
"DataGridViewComboBoxCell value is not valid. To replace this default dialog please handle the DataError event."
. 오류의 원인이되는 문제를 해결하고 싶습니다. 이것은 내가 목록을 채우는 오전하는 방법입니다 :이 문제를 해결하는 방법에 대한
class ManageProcsRecord
{
public SectionType PageSection { get; set; }
public Int32 ContentID { get; set; }
public String Content { get; set; }
public Int32 SummaryID { get; set; }
public RoleType UserRole { get; set; }
public String Author { get; set; }
public String SysTime { get; set; }
}
public enum SectionType
{
ESJP_SECTION_HEADER = 1,
ESJP_SECTION_FOOTER,
ESJP_SECTION_BODY
}
public enum RoleType
{
ESJP_ROLE_NONE = 1,
ESJP_ROLE_TEST_ENG,
ESJP_ROLE_FEATURE_LEAD,
ESJP_ROLE_TEAM_LEAD
}
List<ManageProcsRecord> records =
this.dbif.GetProcedure(this.procList.ElementAt(selectedIndex).PrimaryKey);
foreach (ManageProcsRecord record in records)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(this.dataGridView1);
row.Cells[0].ValueType = typeof(SectionType);
row.Cells[0].Value = record.PageSection;
row.Cells[1].Value = record.Content;
row.Cells[2].Value = (record.SummaryID != -1);
row.Cells[3].ValueType = typeof(RoleType);
row.Cells[3].Value = record.UserRole;
row.Cells[4].Value = record.Author;
row.Cells[5].Value = record.SysTime;
this.dataGridView1.Rows.Add(row); // error fest starts here
}
어떤 생각이나 제안이 훨씬 appreciatd 있습니다!
그 트릭을 했어, 고마워! 나는 문제가 내가 어떻게'DataSource' 컬럼을 설정하는지에 있다고 생각한다. –