All,
I found the cause of the problem. When I made a call to the business tier
(via .NET remoting on a separate computer) to returne a new dataset, all the
binding information is gone. I guess that the binding information is not
been kept when you retrieve a dataset over .NET remoting. (I did not
experience the same problem when the business tier is run locally).
As a result, the data source for the currency manager is null. Thus,
CurrencyManager's position value is always equals to -1.
Thanks,
JY
"Bart Mermuys" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> >"John Yung" <(E-Mail Removed)> wrote in message
> >news:(E-Mail Removed)...
> >Hi,
>
> >My program binds several controls on a WinForm to a Data Table via
> >CurrencyManager.
> >
> >Example:
> >
> > txtComment.DataBindings.Add("Text", _currentDS.WithholdingTax,
"Comment");
> > txtComment.DataBindings[0].Parse += new
> > ConvertEventHandler(frmMain_Parse);
> >
> > ....
> >
> > _cmCurrentRecord =
> > (CurrencyManager)this.BindingContext[_currentDS.WithholdingTax];
> >
> >
> >The data in Data Table is retrieve via a remote call to a business
object.
> >After
> >the data is retrieve, I call the Refresh method on the currency manager.
>
> >Before I move to .NET 2.0, the values on the form would be refresh.
> >However,
> >since I moved to .NET 2.0, the values no longer refresh on the screen.
>
> Do you actually fill _currentDS.WithholdingTax or assign a new DataSet to
> _currentDS ? If you fill it then the CurrencyManager should automatically
> refresh but if you assign a new DataSet then i don't see how any refresh
> will help, you will need to rebind the controls.
>
> >After I did some debugging, I noticed the Position value of the currency
> >manager is
> > always at -1. So before I call the Refresh method on the currency
manager,
> > I manually
> >set the position value to 0 (the first record on the datatable, and I
> >vertified the record exist
> >on the datatable). That did not help, the position value is still equals
to
> >0.
>
> If Count == -1 then the underlying DataSource doesn't contain any rows.
>
> HTH,
> Greetings
>
> >Anyone know why this happens?
>
>
> >Thanks,
>
> >John Yung
>
>
|