title: Get Sum of datagridview Column using Linq for a distinct ID
body: <p>I have two forms <code>Form1(DGV1 &amp; DGV2)</code> and <code>Form2(DGV3 &amp; DGV4)</code> with <code>Datagridview</code> controls on both the forms.</p>
  
  <p>On <code>Form1</code> there is a button link to <code>Form2</code> where user can add rows to <code>Form1</code> <code>datagridview(DGV1)</code>. In <code>Form2 → (DGV3 and DGV4)</code>, there is a <code>checkbox</code> in the first column and the user can select only one row at a time. </p>
  
  <p>There are two buttons on <code>Form2</code>: <code>Done</code> and <code>Add Items</code></p>
  
  <p>When user clicks on Add Items by selecting the rows one after another,the rows must be added to the <code>datagridview</code> on <code>Form1</code> and when Done button is clicked, <code>Form1</code> should be displayed with all the rows that are added.</p>
  
  <p>I have achieved this.</p>
  
  <p>The columns in <code>DGV1</code> and <code>DGV2</code> are</p>
  
  <p><strong>DGV1 Columns</strong></p>
  
  <pre><code>Sno Desciption SellQty ItemID
  ----------------------------
   1    ABC       0         1 
   2    XYZ       0         2
  </code></pre>
  
  <p><strong>DGV2 Columns</strong></p>
  
  <pre><code>Sno BatchNo SellQty ItemID
  ----------------------------
  1    123       10         1
  2    528       20         2
  1    568       30         1
  2    522       40         2
  </code></pre>
  
  <p>During the loading of <code>Form1</code>, how can I get the sum of <code>SellQty</code> depending on <code>ItemID</code> for <code>Form → DGv2</code> and update the value of <code>SellQty</code> in  <code>DGV1</code>.</p>
  
  <p>Example: <code>For ItemID=1  sum(SellQty)=40</code> </p>
  
  <p>so I need to assign this value to <code>DGV1 SellQty Column=40</code>.</p>
  
  <p>Please advice.</p>