DataGridView, getting the dirty value of a cell when editing

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!
 
T

Tim Van Wassenhove

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";
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top