Note that there are some explanatory texts on larger screens.

plurals
  1. PODataGridView cell edit end event
    primarykey
    data
    text
    <p>I have a DataGridView in which i have a column 'total'. DataGridView is editable true. below the grid view i have textbox in which i want the total of the 'total' column of grid. What i did is, when user enters into the total column in grid, it reflects into the total text field belo the grid view. to display total in the textfield, i added the total column of grid view. But the problem is, if first time i enter into the total column of grid view, it immediately reflects into the textfield below. but if i edit the same value in total column of DataGridView, the textfield below the grid adds it with previous value where i want the new edited value in the textfield. How to fix this?Following is the code:-</p> <pre><code>private void grdCaret_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { string value = grdCaret.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); if (e.ColumnIndex == 1) { // int val = int.Parse(value); // quantity = val; // ekundag = ekundag + quantity; //tbTotDag_cr.Text =ekundag.ToString(); int quantity = 0; foreach (DataGridViewRow row in grdCaret.Rows) quantity +=(int) grdCaret.Rows[e.RowIndex].Cells[1].Value.ToString(); //quantity +=(int) row.Cells[1].Value; tbTotDag_cr.Text = quantity.ToString(); } if (e.ColumnIndex == 2) { float val = float.Parse(value); total = val; ekunrakam = ekunrakam + total; tbTotPrice_cr.Text = ekunrakam.ToString(); } grdCaret.Columns[3].ReadOnly = false; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload