c# - How can I get two controls on separate forms bound to the same datasource to update each other? -


i have form lot of fields on it, of optional; reasons beyond control, required fields scattered throughout form rather than, say, grouped @ top big "required" label.

i've been asked make separate form can launched main form has required fields. idea user can bring "required fields" form, enter necessary data automatically shows in main form enter it, close "required fields" form , fill in optional fields want on main form, , save form.

i've got fields on "required" form bound exact same data sources associated fields in main form, , know that's working because can enter information in "required" form , save, , entered data gets saved. problem while data source behind scenes gets updated, corresponding field on other form doesn't. i'd able have typed in required field on either form instantly show in corresponding field on other form, people understand it's storing input regardless of field use.

i know how manually refresh field reflect changes bound data, doing way entail bunch of event handlers in both forms saying, "if field x changed, go change field x in other form", both ludicrously repetitive , way coupled. there way can set controls automatically refresh when bound data source changes? bound data source table in system.data.dataset, making own data source implements inotifypropertychanged seems overkill; there other way haven't noticed?

inotifypropertychanged mechanism automatic refreshing in .net, need implement if want form automatically update in response bound data changing.

if have ui control bound data source, there 2 ways ui control updated:

  1. ui control polls data source every time period t
  2. data source notifies ui control when changes

polling bad performance reasons. inotifypropertychanged mechanism data sources notify ui controls of changes.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -