How can I validate input to the edit control of a cell in a DataGridView?

If I understand your question correctly, you want to choose to wire up an event based on the type of the editing control If so, this is what I'd do.

If I understand your question correctly, you want to choose to wire up an event based on the type of the editing control. If so, this is what I'd do: private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { //Remove any KeyPress events already attached e.Control. KeyPress -= new KeyPressEventHandler(FirstEditingControl_KeyPress); e.Control.

KeyPress -= new KeyPressEventHandler(SecondEditingControl_KeyPress); //Choose event to wire based on control type if (e. Control is NumericTextBox) { e.Control. KeyPress += new KeyPressEventHandler(FirstEditingControl_KeyPress); } else if (e.

Control is CurrencyTextBox) { e.Control. KeyPress += new KeyPressEventHandler(SecondEditingControl_KeyPress); } } I've learned from experience to unwire any possible events on editing controls in DataGridView's, since they will reuse the same control for multiple cells.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions