I have a DataGridView which I'm using the DefaultValuesNeeded to populate
every column in a row.
I'm only able to get a new editable row created if I manually edit one of
the cells (as soon as I hit a key in a cell to change the value, a new row
appears which can be clicked on and the DefaultValuesNeeded event get fired
again to populate that row.
Since all the cells have default values, and the user might not want to edit
any of the cells (just accept the default), I want to commit (not sure if
that's the right term)the row as soon as the default values are specified.
But I can't figure out the right combo of event(s) / method(s) to call to get
the DataGridView to just accept the defaults as a fully entered row of data.
This is a data bound control to a DataTable in a DataSet.
Thanks for any help.
Hemol - 04 Nov 2007 18:04 GMT
Ah, figured it out I think:
In the DefaultValueNeeded event, after setting the values, I'm doing this:
DataGridView dgv = sender as DataGridView;
dgv.BindingContext[dgv.DataSource, dgv.DataMember].EndCurrentEdit();
> I have a DataGridView which I'm using the DefaultValuesNeeded to populate
> every column in a row.
[quoted text clipped - 13 lines]
>
> Thanks for any help.
Shawn.KL.Tucker@gmail.com - 19 Dec 2007 22:45 GMT
> Ah, figured it out I think:
>
[quoted text clipped - 22 lines]
>
> - Show quoted text -
This does the same thing as DataGridView.EndEdit();