Why can't I see the DataGridViewRow added to a DataGridView?

前端 未结 3 802
温柔的废话
温柔的废话 2021-01-13 02:02

I am trying to show rows in a DataGridView.

Here\'s the code:

foreach (Customers cust in custList)
            {
                string[] rowValues =         


        
3条回答
  •  一个人的身影
    2021-01-13 02:34

    foreach (Customers cust in custList)
                {
                      DataGridViewRow row = new DataGridViewRow();
                      dataGridView1.BeginEdit();
                      row.Cells["Name"] = cust.Name;
                      row.Cells["Phone"] = cust.PhoneNo;
                      row.Tag = cust.CustomerId;
                      dataGridView1.Rows.Add(row);
                      dataGridView1.EndEdit();
                }
    

    try this

提交回复
热议问题