Record Navigation - Form and Grid

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
 
O

One Handed Man

dataGrid.CurrentCellChanged may help?!?

I wouldnt swear to it, but i think this fires before the currency manager
gets updated, you need to check.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
B

Bob Costello

One Handed Man,

I did try that as well as other grid events.

The one event I found that is fired before the
CurrencyManager gets updated is the MouseDown. The only
trick here is that if the user clicks on the same grid
row, I will have to have logic that can detect this.

Thanks for your input,

Bob Costello
-----Original Message-----
dataGrid.CurrentCellChanged may help?!?

I wouldnt swear to it, but i think this fires before the currency manager
gets updated, you need to check.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


Bob Costello said:
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


.
 
O

One Handed Man

These shortcomings are what keeps us in work eh ?, good luck.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


Bob Costello said:
One Handed Man,

I did try that as well as other grid events.

The one event I found that is fired before the
CurrencyManager gets updated is the MouseDown. The only
trick here is that if the user clicks on the same grid
row, I will have to have logic that can detect this.

Thanks for your input,

Bob Costello
-----Original Message-----
dataGrid.CurrentCellChanged may help?!?

I wouldnt swear to it, but i think this fires before the currency manager
gets updated, you need to check.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


Bob Costello said:
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


.
 

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