I have a peculiar problem. I have a dataset with two
records in it. When I am positioned at the first record
and try to navigate to the second on a form which uses
data binding, the binding manager position does not
change. Any ideas as to what could be happening? Has
anyone else come across this? I will add that if I bind
the same dataset to a datagrid, both records show up
without any exceptions being thrown.

Here is the code for the event handler that I'm using:

private void btnNext_Click(object sender, System.EventArgs
e)
{
BindingManagerBase bmb;
bmb = (BindingManagerBase) this.BindingContext
[dsPolicies,"Table"];
bmb.Position += 1;
UpdateDisplay();
}

private void UpdateDisplay()
{
BindingManagerBase bmb;
bmb = (BindingManagerBase) this.BindingContext
[dsPolicies,"Table"];

this.txtPosition.Text = (bmb.Position + 1).ToString();
this.txtPosition.Text += " of ";
this.txtPosition.Text += bmb.Count.ToString();
}

The Locals window shows that that the dataset has 2
records, the BindingManagerBase has a count of 2 and a
position of 0 which does not seem to change at all.

I hope someone out there can tell me what is going on!

Re: Binding Manager Position not changing by Miha

Miha
Thu Jan 08 04:01:32 CST 2004

Hi Kunjal,

You are probably getting the wrong bindingmanagerbase.
Try this:
bmb = (BindingManagerBase) this.BindingContext [dsPolicies.Tables["Table"]];

BTW, how do you bind table?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Kunjal Karamshi" <anonymous@discussions.microsoft.com> wrote in message
news:296201c3d56d$1ee288a0$3101280a@phx.gbl...
> I have a peculiar problem. I have a dataset with two
> records in it. When I am positioned at the first record
> and try to navigate to the second on a form which uses
> data binding, the binding manager position does not
> change. Any ideas as to what could be happening? Has
> anyone else come across this? I will add that if I bind
> the same dataset to a datagrid, both records show up
> without any exceptions being thrown.
>
> Here is the code for the event handler that I'm using:
>
> private void btnNext_Click(object sender, System.EventArgs
> e)
> {
> BindingManagerBase bmb;
> bmb = (BindingManagerBase) this.BindingContext
> [dsPolicies,"Table"];
> bmb.Position += 1;
> UpdateDisplay();
> }
>
> private void UpdateDisplay()
> {
> BindingManagerBase bmb;
> bmb = (BindingManagerBase) this.BindingContext
> [dsPolicies,"Table"];
>
> this.txtPosition.Text = (bmb.Position + 1).ToString();
> this.txtPosition.Text += " of ";
> this.txtPosition.Text += bmb.Count.ToString();
> }
>
> The Locals window shows that that the dataset has 2
> records, the BindingManagerBase has a count of 2 and a
> position of 0 which does not seem to change at all.
>
> I hope someone out there can tell me what is going on!
>