私は、C# で記述された Windows フォーム アプリケーションに取り組んでいます。
List<>
コントロールから作成する方法について誰かの提案を見つけましたがDataGridView
、セル値を抽出する方法についてはもう少し助けが必要です。
与えられたコードは次のとおりです。と に 2 つの列がdataGridView1
あるName
としAddress
ます。オブジェクト
を構築する方法は?List<ProjList>
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
ProjList = new List<ProjectMasterRec>();
foreach (DataGridViewCell dc in dr.Cells)
{
// build out MyItem
// based on DataGridViewCell.OwningColumn and DataGridViewCell.Value
// how do we code this?
}
ProjList.Add(item);
}