DataGridView, getting the dirty value of a cell when editing

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

Hi guys,

I have a problem with the DataGridView. I want to catch the value of a cell
when the user is editing it. Actually, I can't figure if there is an event
or a property to get this value.

For example, when the user type something on a cell, I want to display what
he wrote on another place in my application. I don't care if this text isn't
going to be used finally (a.k.a, if the user cancel the editing mode).

Is there a way to do that? I really can't figure any.

Thanks!
 
Hi guys,

I have a problem with the DataGridView. I want to catch the value of a cell
when the user is editing it. Actually, I can't figure if there is an event
or a property to get this value.

For example, when the user type something on a cell, I want to display what
he wrote on another place in my application. I don't care if this text isn't
going to be used finally (a.k.a, if the user cancel the editing mode).

Is there a way to do that? I really can't figure any.

Uses the DGV EditingControlShowing event to get at the control..
Here is an example for a DataGridViewTextBoxColumn...

private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
TextBox textBox = e.Control as TextBox;
textBox.Text = "hihi";
}
 
Back
Top