Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 18th, 2012  |  syntax: None  |  size: 0.88 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to set value from grid column to textbox?
  2. private void grdCaret_CellEndEdit(object sender, DataGridViewCellEventArgs e)
  3.     {
  4.         try
  5.         {
  6.  
  7.             string value = grdCaret.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
  8.             if (e.ColumnIndex == 1)
  9.             {
  10.                int val = int.Parse(value);
  11.                quantity = val;
  12.                ekundag = ekundag + quantity;
  13.                tbTotDag_cr.Text =ekundag.ToString();
  14.             }
  15.  
  16.             if (e.ColumnIndex == 2)
  17.             {
  18.                 float val = float.Parse(value);
  19.                 total = val;
  20.                 ekunrakam = ekunrakam + total;
  21.                 tbTotPrice_cr.Text = ekunrakam.ToString();
  22.             }
  23.             grdCaret.Columns[3].ReadOnly = false;
  24.         }
  25.         catch (Exception ex)
  26.         {
  27.             MessageBox.Show(ex.Message.ToString());
  28.         }
  29.     }