If the grid is bound, edit the underlying data source. I dont ever add rows
and columns to a grid with out binding it. I make a DataTable first and let
that be the container for the data. Then I can bind the grid to it and update
the DataTable when needs be.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"DanThMan" wrote:
> The situation:
>
> * I have a ButtonColumn in a DataGridView.
> * When the user preses one of the buttons, a dialog appears.
> * Based on what the user selects in the dialog, data is entered
> programmatically into the the underlying cell (i.e., I'm setting Value
> property of the cell based on user input, but the user is not directly
> entering any data).
>
> The problem:
>
> The DataGridView doesn't seem believe the user has edited the row, so
> if the user clicks or tabs somewhere else (which causes the
> DataGridView to lose focus), all the changes to the row get
> cleared/canceled.
>
> Other information:
>
> Looking at the RowHeaderCell for the row as it's being edited, it
> changes from a large asterisk[*] to a right arrow + asterisk [>*].
> This is different than if the user directly edits a cell by typing (in
> that case, you'd get a pencil icon while the cell is in edit mode
> followed by a large right arrow after the change is committed).
>
> My question:
>
> So, how do I programmatically tell the DataGridView that the user
> really has touched/edited this row and that the data should stick even
> if the DataGridView loses focus.
>
> Thanks!
>
> -Dan
>
>