Ah Ha... I found the solution!
....
this.dataView = new DataView(this.dataTable);
this.dataGrid.DataSource = this.dataView;
this.currencyManager = (CurrencyManager)
this.BindingContext[this.dataTable];
public void CompleteEdit()
{
this.dataGrid.EndEdit(this.dataGridTextBoxColumnTa skMarks,
this.dataGrid.CurrentCell.RowNumber, false);
this.currencyManager.Position = this.dataGrid.CurrentCell.RowNumber;
this.currencyManager.EndCurrentEdit();
}
But I don't understand why calling the CurrencyManager.EndCurrentEdit() is a
must after calling the DataGrid.EndEdit()!?!?
--
Soul
"Soul" <no@spam.com> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
| Hi,
|
| I tried, but it doesn't work. I think it is because I don't really
| understand about the BindingManagerBase. I tried to follow the example
from
| MSDN and modified my code as follow:
|
| // private variebles declared here
| ...
| ...
|
| public myForm(DataTable aTable)
| {
| InitializeComponent();
|
| this.myDT = aTable;
| this.tableName = this.myDataTable.TableName.ToString();
| this.myDV = new DataView(this.myDT);
| this.myDG.DataSource = this.myDV;
|
| /* I think I did something wrong here. */
| this.bingingManagerBase = (CurrencyManager) BindingContext[this.myDV];
|
| this.myDV.AllowNew = false;
| this.myDV.AllowDelete = true;
| this.dataGridTableStyle.MappingName = tableName;
| this.myDT.ColumnChanging += new
| DataColumnChangeEventHandler(this.dataTable_ValueC hanging);
| }
|
| public DataTable UpdatedTable
| {
| get
| {
| this.bingingManagerBase.EndCurrentEdit();
|
|
MessageBox.Show(this.dataTable.Rows[this.dataGrid.CurrentCell.RowNumber]["ta
| skMarks"].ToString());
| return this.dataTable.GetChanges();
| }
| }
|
| Once the user click on the save button on the parent form, the
UpdatedTable
| in the child form will be called. But I still see the current editing row
of
| the DataGrid in the active child form still in editing mode.
|
| Please show me where did I miss out?
|
| Thank you.
|
| --
| Soul
|
|
| "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
| message news:Of**************@TK2MSFTNGP10.phx.gbl...
| | Soul,
| |
| | I think that what you want to do is get the BindingManagerBase for
the
| | form (which is keyed on the DataView that the grid is bound to). When
you
| | have that, you can call the EndCurrentEdit method and it should commit
| | whatever you were editing. You can do this before you save the data
back
| to
| | the grid.
| |
| | Hope this helps.
| |
| |
| | --
| | - Nicholas Paldino [.NET/C# MVP]
| | -
mv*@spam.guard.caspershouse.com
| |
| | "Soul" <no@spam.com> wrote in message
| | news:eY***************@tk2msftngp13.phx.gbl...
| |
| | > [Snipped]
|