DataBinding

  • Thread starter Peter Morris [Droopy eyes software]
  • Start date
P

Peter Morris [Droopy eyes software]

If I execute the following line

DataGrid1.Dispose();

it will commit all user changes being made via databinding. I'd like to
know how I can commit all user changes to all controls within a form without
having to Dispose of the controls.

I have a component that tracks which of my business objects are modified
during the lifetime of its parent form, but unfortunately if the user closes
the form without leaving the focussed control (cell in a datagrid) the
change is not applied until the Dispose method is executed, and by then my
component has been disabled.

So I basically need to commit all changes made within the form's controls
from within the Closing event. I need to perform this function from within
my component's code so will therefore have no knowledge of the specific
controls on the form or their types.

Thanks

Pete
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Well a quick way of doing this is intercepting the closing event of the
form, and then either disposing the control or move out the focus.
 
P

Peter Morris [Droopy eyes software]

Well a quick way of doing this is intercepting the closing event

Doing that.

and then either disposing the control

I can't do that as I don't "own" the form (I am just a component developer,
the form will belong to the user). I don't know if the user is just closing
the form and will reshow the same instance or if they intend to dispose of
it.

or move out the focus.

I don't want to do this either because I don't know
A) Which control to give focus to
B) If changing focus on the form will have some kind of adverse side effect
(event code for gaining/losing focus).

So I need to the the "proper" way :)


Pete
 
P

Peter Morris [Droopy eyes software]

Guys, I would *really* appreciate some help with this one. I have looked
into it but as yet still been unable to find the solution to it.

Thanks

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top