私はこの日のほとんどの作業をしており、解決策は私を逃れ続けています。私のWinformアプリケーションにはDataGridView
が含まれており、そのうちの2つはドロップダウンリストComboBox
です。奇妙なことに、DataGridView
は正しく配置されているように見えますが、マウスオーバーしたとき、またはDataGridVeiw
に関連する他のトリガー可能なイベントがあるときはいつでも、過多なエラーが発生します。具体的には、System.ArgumentException
とSystem.FormatException
の2つの繰り返しエラーが発生しています。これらのエラーの両方のためのメッセージ・テキストは次のとおりです。C#ランタイムエラー: "DataGridViewComboBoxCellの値が有効ではありません"
"DataGridViewComboBoxCell value is not valid. To replace this default dialog please handle the DataError event."
私は単にDataError
イベントを処理することにより、この問題をマスクする必要はありません。 エラーを引き起こしている問題を解決したい。これは私がリストを移入しています方法です。これを解決する方法について
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'をどのように設定していたかであったと思います。 –