public class PurchaseOrderItem
{
public Int64 PONumber { get; set; }
public string Description { get; set; }
public string UM { get; set; }
public int QTY { get; set; }
public decimal Cost { get; set; }
}
foreach (PurchaseOrderItem item in po.PurchaseOrderItems)
{
dgvPOItem.Rows.Add(item);
}
The Foreach above isn’t working.
I can’t use DataSource since i need to add a blank row after adding the data
So there will be a empty row where users can add values on gridview in the future.
can’t you use a
BindingList<PurchaseOrderItem>?this should allow you to add items to your collection from dgv control (using empty row)
Edit: I’ve created simple WinForm app,
only DGV control in the main form
Form1.cs code: