B
Bob Costello
I have a Windows form that is used for both data entry
and record navigation. The form is split into two
sections. The upper part contains a number of text
controls. I bind the values in each text control to a
DataView named dvUserData. Below these controls is a
navigation toolbar containing Prev, Next etc buttons as
well as a label saying what the current record position
is.
I control navigation of the records with the use of a
CurrencyManager object defined as follows:
cmUserData =
(CurrencyManager) this.BindingContext[dvUserData, ""];
Pressing the navigation buttons results in the
modifiction of cmUserData.Position. Just before Position
is modified, I check to see if the user has any unsaved
changes and if so, asks if he wishes to save them.
This works fine. I also display a data grid in the bottom
half of the form. This grid is bound to the same DataView
and its purpose is to show the user many rows of the same
data. I allow the user to navigate the records by
clicking in the data grid. If a different row in the grid
is clicked, the new record data is reflected in the top
part of the form as well.
This also works fine. However, there seems to be no
DataGrid or CurrencyManager events which would let me
know the record position is changing, before it actually
changes (I need this to check for unsaved changes).
I can handle the CM OnPositionChanged event but by the
time this is called, the controls already reflect the
values in the next record. It seems as if I need an event
called OnPositionChanging or some other technique that
could accomplish the same thing.
Any help greatly appreciated.
Thanks in advance and regards,
Bob Costello
and record navigation. The form is split into two
sections. The upper part contains a number of text
controls. I bind the values in each text control to a
DataView named dvUserData. Below these controls is a
navigation toolbar containing Prev, Next etc buttons as
well as a label saying what the current record position
is.
I control navigation of the records with the use of a
CurrencyManager object defined as follows:
cmUserData =
(CurrencyManager) this.BindingContext[dvUserData, ""];
Pressing the navigation buttons results in the
modifiction of cmUserData.Position. Just before Position
is modified, I check to see if the user has any unsaved
changes and if so, asks if he wishes to save them.
This works fine. I also display a data grid in the bottom
half of the form. This grid is bound to the same DataView
and its purpose is to show the user many rows of the same
data. I allow the user to navigate the records by
clicking in the data grid. If a different row in the grid
is clicked, the new record data is reflected in the top
part of the form as well.
This also works fine. However, there seems to be no
DataGrid or CurrencyManager events which would let me
know the record position is changing, before it actually
changes (I need this to check for unsaved changes).
I can handle the CM OnPositionChanged event but by the
time this is called, the controls already reflect the
values in the next record. It seems as if I need an event
called OnPositionChanging or some other technique that
could accomplish the same thing.
Any help greatly appreciated.
Thanks in advance and regards,
Bob Costello