![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
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(); "Hemol" wrote: 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.- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |