<p>In my .NET/Forms app I have a DataGridView which is bound to a DataTable. The user selects a row of the DataGridView by double-clicking and does some interaction with the app. After that the content of the row is updated programmatically.</p>

<p>When the user selects a new row the changes on the previous one are automagically propagated to the DataTable by the framework. How can I trigger this update from my code so the user does not have to select a new row?</p>

[{'answer_id': 73224, 'author': 'Nicholas', 'author_id': 8054, 'author_profile': 'https://Stackoverflow.com/users/8054', 'pm_score': 0, 'selected': False, 'text': '<p>I guess it depends on what triggers the update to take place, if it is in a validation routine you could simply call that after the user clicks OK on editing the data.  Your question is vague it would be easier to answer with more information.  What is this interaction?  Is it a dialog?  What actually updates the data?</p>\n'}, {'answer_id': 74210, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Here is the process to clarify this:</p>\n\n<ol>\n<li>user doubleclicks row</li>\n<li>app fetches data from db, processes fetched data and fills controls on the same form as the DataGridView</li>\n<li>user interacts with controls and finally presses apply button on the same form</li>\n<li><p>app processes state of controls, writes data to db and writes data to DataGridView</p></li>\n<li><p>IF user moves selection on DataGridView</p></li>\n<li><p>THEN changes are propagated to the bound DataTable</p></li>\n</ol>\n\n<p>I would like to trigger 6 instantly after modifying the DataGridView from my code.</p>\n'}, {'answer_id': 78521, 'author': 'Blorgbeard', 'author_id': 369, 'author_profile': 'https://Stackoverflow.com/users/369', 'pm_score': 2, 'selected': False, 'text': '<p>I just had the same issue, and found the answer <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.iscurrentrowdirty.aspx" rel="nofollow noreferrer">here</a>:</p>\n\n<blockquote>\n  <p>When the user navigates away from the\n  row, the control commits all row\n  changes. The user can also press\n  CTRL+ENTER to commit row changes\n  without leaving the row. To commit row\n  changes programmatically, call the\n  form\'s Validate method. If your data\n  source is a BindingSource, you can\n  also call BindingSource.EndEdit.</p>\n</blockquote>\n\n<p>Calling Validate() worked for me.</p>\n'}]
['https://Stackoverflow.com/questions/72791', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']