2
我有一個DataGridView
從數據庫填充,我需要採取每一行,並創建一個對象。我無法弄清楚如何去做。DataGridView行循環和單元格數據訪問
DataGridView Columns: Name Price ProductId Condition MemberId Description
代碼,我有:
foreach(DataGridViewRow row in members_dg.rows)
{
foreach(DataGridViewCell cell in row.Cells)
{
// need to get info. This should show u what im looking for.
//string name = cell1.Text;
//string price = cell2.Text;
//etc
//Member member = new Member(name, price, ...);
}
}
發現這非常有幫助。當您查看VS中的數據結構時,使用的實際語法並不是很明顯,至少對我而言是如此。 – octopusgrabbus