G
Guest
Hi Team
this may be a newbie question. I have searched the discussions before
posting:
I'd like to re-use a form instance to edit record details. My data binding
(a DataTable bound to TextBoxes) works fine the first time round. I can see,
edit and update the details from my form, then close the form.
I then like to select and refill the datatable with a different record (new
query) and open the same form again. I send the new datatable to the
(existing yet invisible) form before using ShowDialog. I have confirmed that
the new datatable has the new record data in it, consists of only one row and
has indeed arrived at the form. I clear the data bindings of all the
textboxes and re-set them with the new datatable. (I have also tried to
ResetBindings() for the form at this point.)
But no matter what I try in terms of Update(), Refresh(), Invalidate() the
textboxes stubbornly display the data from the original binding! I have
tried to update before and after the form has appeared. I have also tried to
keep the original binding but clear and then re-fill the datatable with a new
record from the database, all to no avail. I'm at my wits end.
Of course it works just fine, when I re-instantiate a new form each time I
wish to edit a new record, but I reckon that is inefficient; and also I'd
like to find out how this binding mechanism really works.
Any ideas are much appreciated.
Thanks
Matthias
this may be a newbie question. I have searched the discussions before
posting:
I'd like to re-use a form instance to edit record details. My data binding
(a DataTable bound to TextBoxes) works fine the first time round. I can see,
edit and update the details from my form, then close the form.
I then like to select and refill the datatable with a different record (new
query) and open the same form again. I send the new datatable to the
(existing yet invisible) form before using ShowDialog. I have confirmed that
the new datatable has the new record data in it, consists of only one row and
has indeed arrived at the form. I clear the data bindings of all the
textboxes and re-set them with the new datatable. (I have also tried to
ResetBindings() for the form at this point.)
But no matter what I try in terms of Update(), Refresh(), Invalidate() the
textboxes stubbornly display the data from the original binding! I have
tried to update before and after the form has appeared. I have also tried to
keep the original binding but clear and then re-fill the datatable with a new
record from the database, all to no avail. I'm at my wits end.
Of course it works just fine, when I re-instantiate a new form each time I
wish to edit a new record, but I reckon that is inefficient; and also I'd
like to find out how this binding mechanism really works.
Any ideas are much appreciated.
Thanks
Matthias