Beispiel #1
0
        private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            // the toolbar doesn't get the focus when clicked, so
            // the grid could still be in edit mode...
            _flex.FinishEditing();

            // the grid still has the focus and the cursor hasn't moved to a new row,
            // so the data source still doesn't see the row as changed.
            // so we use the currency manager to end the edits.
            CurrencyManager cm = (CurrencyManager)BindingContext[_flex.DataSource, _flex.DataMember];

            cm.EndCurrentEdit();

            // proceed as usual
            button1_Click(sender, EventArgs.Empty);
        }