Binding Manager Position

  • Thread starter Thread starter Bob Ranck
  • Start date Start date
B

Bob Ranck

VB[WinForm]

I am using a Binding Manager loacated in a Data Access
Layer.

Lets say in a test dataview I have 9 rows and I add a new
Row using the BindingManager.AddNew Function.

If I look at the BindingManager.Count - at this point I
have a count of 10 rows as expected.

However

If I look at BindingManager.Position, it is pointing to
row 0. (and in addition any of my attempts to set it to
row 9 fail) It seems to be determined to stay at row Zero
Of course and editing is now affecting the first row of
the dataview instead of the row that was added.

Can anyone tell me how to avoid this problem or to point
to row 9 instead??

Bob
 
Bob,

Do you get an error or does it just not move?

Can you show the code where you are adding the row and trying to move the
current row? One possibility is that they aren't pointing to the same
binding manager.

Kathleen
 
Hi Kathleen,

I just got back.

I think I only have one Binding Manager but you may show
me that I really have more than one.

I'm finding code to show you now.

Bob Ranck
-----Original Message-----
Bob,

Do you get an error or does it just not move?

Can you show the code where you are adding the row and trying to move the
current row? One possibility is that they aren't pointing to the same
binding manager.

Kathleen

Bob Ranck said:
VB[WinForm]

I am using a Binding Manager loacated in a Data Access
Layer.

Lets say in a test dataview I have 9 rows and I add a new
Row using the BindingManager.AddNew Function.

If I look at the BindingManager.Count - at this point I
have a count of 10 rows as expected.

However

If I look at BindingManager.Position, it is pointing to
row 0. (and in addition any of my attempts to set it to
row 9 fail) It seems to be determined to stay at row Zero
Of course and editing is now affecting the first row of
the dataview instead of the row that was added.

Can anyone tell me how to avoid this problem or to point
to row 9 instead??

Bob


.
 
Kathleen,

Let's see if I can summarize,
1.) I get no error,
2.) If I go ahead and edit the new row and save it, I
have actually modified the FIRST row. My
BindingNavigator reports that I am working on Row 1 of
10, but when I try to move by position to the tenth
record my binding navigator stops at 9 of 10 records
3.) My DAL uses a singleton property at a module level to
assure that I only have one copy of the DAL
4. My DAL has two sets of functions one for programatic
use and a second set for binding.

Your suggestion of two copies makes sense, but I wish
they had a serial number or something so that I
could "See" that I have two.

What is a good trouble shooting technique to determine if
a person has inadverntly created two binding managers for
the same data?

Bob Ranck
-----Original Message-----
Bob,

Do you get an error or does it just not move?

Can you show the code where you are adding the row and trying to move the
current row? One possibility is that they aren't pointing to the same
binding manager.

Kathleen

Bob Ranck said:
VB[WinForm]

I am using a Binding Manager loacated in a Data Access
Layer.

Lets say in a test dataview I have 9 rows and I add a new
Row using the BindingManager.AddNew Function.

If I look at the BindingManager.Count - at this point I
have a count of 10 rows as expected.

However

If I look at BindingManager.Position, it is pointing to
row 0. (and in addition any of my attempts to set it to
row 9 fail) It seems to be determined to stay at row Zero
Of course and editing is now affecting the first row of
the dataview instead of the row that was added.

Can anyone tell me how to avoid this problem or to point
to row 9 instead??

Bob


.
 
Bob,

The rub is that WIndows.Forms is so helpful it creates a new binding manager
for you if it if you don't specify it _exactly_ the same way. This problem
particularly occurs with datasets, where DataSet, "Table.Field" and
DataSet.Table, "Field" creates two diferent binding managers. You could
check how many binding managers you have on your form - I'd have to look up
the syntax as I haven't done that for a while.

The other possible source is that the row is 0 based. Thus the tenth row has
an ordinal of 9.

Kathleen

Bob Ranck said:
Kathleen,

Let's see if I can summarize,
1.) I get no error,
2.) If I go ahead and edit the new row and save it, I
have actually modified the FIRST row. My
BindingNavigator reports that I am working on Row 1 of
10, but when I try to move by position to the tenth
record my binding navigator stops at 9 of 10 records
3.) My DAL uses a singleton property at a module level to
assure that I only have one copy of the DAL
4. My DAL has two sets of functions one for programatic
use and a second set for binding.

Your suggestion of two copies makes sense, but I wish
they had a serial number or something so that I
could "See" that I have two.

What is a good trouble shooting technique to determine if
a person has inadverntly created two binding managers for
the same data?

Bob Ranck
-----Original Message-----
Bob,

Do you get an error or does it just not move?

Can you show the code where you are adding the row and trying to move the
current row? One possibility is that they aren't pointing to the same
binding manager.

Kathleen

Bob Ranck said:
VB[WinForm]

I am using a Binding Manager loacated in a Data Access
Layer.

Lets say in a test dataview I have 9 rows and I add a new
Row using the BindingManager.AddNew Function.

If I look at the BindingManager.Count - at this point I
have a count of 10 rows as expected.

However

If I look at BindingManager.Position, it is pointing to
row 0. (and in addition any of my attempts to set it to
row 9 fail) It seems to be determined to stay at row Zero
Of course and editing is now affecting the first row of
the dataview instead of the row that was added.

Can anyone tell me how to avoid this problem or to point
to row 9 instead??

Bob


.
 
Back
Top