Akash Pal

Akash Pal

  • NA
  • 1
  • 704

How to save the changed value of DataGrid cell into a string

Jun 16 2015 1:00 AM
private void label5_Click(object sender, EventArgs e)
{


int rowIndex = dataGridView1.CurrentCell.RowIndex;

int columnIndex = dataGridView1.CurrentCell.ColumnIndex;

string ColumnName = dataGridView1.Columns[columnIndex].Name;
string NewValue = dataGridView1.Rows[rowIndex].Cells[columnIndex].FormattedValue.ToString();
MessageBox.Show(dataGridView1.CurrentCell.Value.ToString());

global.EditBook(columnIndex, rowIndex, ColumnName, NewValue);
DataTable dt = global.filldata();
dataGridView1.DataSource=dt;
pictureBox7.Visible = true;
MessageBox.Show(dataGridView1.Columns[columnIndex].Name.ToString());
}