Click here to Skip to main content
15,908,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagidview . when I make changes to the cells of datagridview and try to save it ,it is not getting saved when the cursor is in the same row. and it is getting saved when the cursor is in any other row. I used the following event but no use . i have to each time keep the cursor intentionally to some other row in order to save the change.

thanks in advance
C#
private void dataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            

            if (dataGridView1.IsCurrentCellDirty)
            {
                dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit);
               
            }
        }
Posted
Updated 20-Oct-11 8:13am
v2
Comments
Orcun Iyigun 20-Oct-11 14:56pm    
I am not certain but after commitediting you can dataGridView1.EndEdit(); so this will end the editing. Hope it helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900