M
Mark Olbert
I am trying to do something that ought to be very simple. But I cannot get it to work.
What I want to do, on a data form, is allow the user to click a button to create a new record, which
is then initialized prior to any further editing. The data form's controls are all bound to one
particular dataview.
The strategy I'm using is:
1) create record
2) modify record in code (which changes the sort order location of where the new record should be in
the dataview)
3) find location of new record in dataview
4) reposition on new record
Oddly enough, I either can't find or can't reposition on the new record. I've tried creating the
record three different ways, by calling ...New() on the dataview's underlying datatable, by calling
AddNew() on the dataview and by calling AddNew() on the bindingcontext for the form.
In all cases, the new record is created and modified properly. But if I create the record in the
dataview or through the bindingcontext, Find() on the dataview won't find it. If I create the record
in the datatable the Find() on the dataview works, but I can't reposition because the assignement to
BindingContext.Position does...nothing. No error, no exception, but no change to the position value,
either.
This is very bizarre. How do others create new records on forms? Do you just leave them blank to be
filled in completely by the user? That won't work in my case.
- Mark
What I want to do, on a data form, is allow the user to click a button to create a new record, which
is then initialized prior to any further editing. The data form's controls are all bound to one
particular dataview.
The strategy I'm using is:
1) create record
2) modify record in code (which changes the sort order location of where the new record should be in
the dataview)
3) find location of new record in dataview
4) reposition on new record
Oddly enough, I either can't find or can't reposition on the new record. I've tried creating the
record three different ways, by calling ...New() on the dataview's underlying datatable, by calling
AddNew() on the dataview and by calling AddNew() on the bindingcontext for the form.
In all cases, the new record is created and modified properly. But if I create the record in the
dataview or through the bindingcontext, Find() on the dataview won't find it. If I create the record
in the datatable the Find() on the dataview works, but I can't reposition because the assignement to
BindingContext.Position does...nothing. No error, no exception, but no change to the position value,
either.
This is very bizarre. How do others create new records on forms? Do you just leave them blank to be
filled in completely by the user? That won't work in my case.
- Mark