2009-11-24 44 views

回答

2

比方說,你有一個名爲IDTextBoxColumn ID列。你可以得到像這樣的每一行的值:

For Each row As DataGridViewRow In MyDataGridView.Rows 
    Console.WriteLine("ID value is " & row.Cells(IDTextBoxColumn.Index).Value.ToString()) 
Next 
1
Domain.Master.Product product = new Domain.Master.Product(); 
      foreach (DataGridViewRow dr in dataGridView1.Rows) 
      { 
       if (dr.Cells[0].Value == null) 
       { } 
       else 
       { 
        ProductViewModel pvm =roduct.ProductDetails(dr.Cells[0].Value.ToString()); 
        dr.Cells[3].Value = pvm.PCode.ToString(); 
        dr.Cells[4].Value = pvm.Pdtcatagory; 
       } 
      } 
相關問題