c# - How is the DataGridViewCell.FormattedValue updated? -


I have control which is expanded by DataGridView control I override the ProcessDialyKey event and throwing it and organizing my own I am able to respond to the Container form cell as a user type.

The problem I am aware of is that when I am editing the "CellEditCision" from within the ProcessDialogKey method of DataGridView, the value of the cell I have been edited has not been updated yet.

So, as the user type 'A', my CellEditKeyPress event starts to fire, but when I get the value cell, that value is still an empty string. The user can then type 'B', I can get the value 'A', and similarly. My event is always behind a keyboard effectively.

For example, this is some code:

 Public class MyDataGridView: DataGridView {Public Representative Zero CellEditKeyPressHandler (Key Data, DataGridViewCell currentCell); Public Event CellEditKeyPressHandler CellEditKeyPress; Protected Override Bull Process System (Keyage Data) {If (CellEditCision! = Faucet) {CellEditCision (Main Data, This.Content Cell); } Return Base (Keydata) of process dialogue; }} 

... and on my form ... after the wiring after the cell edit (in that designer)

 Private Zero myDataGridView1_CellEditKeyPress (Key Data, DataGridViewCell currentCell) {MyDataGridView1.EndEdit (); If (current value! Value = null) {textBox1.Text = currentCell.Value.ToString (); Textbox2.Text = currentCell.FormattedValue.ToString (); } MyDataGridView1.BeginEdit (wrong); } 

Impressed that the content of the text box (1 & amp; 2) I am editing is a letter behind the contents of the cell

I have a command with ProcessDialogKey method Have not tried taking advantage to play. (It may be necessary to think of the method. ProcessDialog's method is called before firing my incident, but he has not changed anything.)

I used "myDataGridView1.EndEdit" to " This.Validate () "in the attempt to get the values ​​of control up to date, but it did not make any difference.

Is there a way to ensure that I am working with cell content so far? What I'm using wrong overrides to achieve is that it works for me:

  private zeros myDataGridView1_CurrentCellDirtyStateChanged (    

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -