When you click on a column of DataGrid, the final increase in DataGrid, put the entire and displayed in the added line. If you want a simple method, please see: Datacolumn.expression property [C #]: Get or set an expression, for filtering the row, the value in the column or create a polymer column.
Stupid follows: bool Sumed = false; // indicating whether the column and private void dataGrid1_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e) {last line DataGrid.HitTestInfo hit = this.dataGrid1.HitTest ( EX, EY); if (hIT.COLUMN! = - 1) {THIS.DATAGRID1.GETCETCELLBOUNDS (Hit.Row, hit.column); // Take the cell's Rectangle, if an error, click the column Head} catch (system.indexoutofrangeException OIR) {// Click on the column header, function code -> sum up, add to the last column int sum = 0; // Some column sum IROW; DATATABLE MyTable; MyTable = DataSet this.dataGrid1.datasource) .tables [0]; if (SUMED) // If the DataGrid has added the column, {DATAROW DRSUM = MyTable.Rows should be removed when the next calculation [MyTable .Rows.count-1]; DRSUM.DELETE ();} for (irow = 0; irow