I have a form with a dataset bound to a datagrid and several textbox controls. I can navigate my data with ease and perform updates but for some reason when I add a new datarow using BindingContext.AddNew, although the BindingContext.Count gets incremented I cannot reference the actual row at that location - it errors out saying there is no row.
Here's sample code:
VB Code:
With tArbiter .Columns("ID").DefaultValue = Guid.NewGuid .Columns("ArbiterKey").DefaultValue = ArbiterID .Columns("FirmKey").DefaultValue = rLawFirm(iFirmPos).Item("ID") .Columns("FirmName").DefaultValue = rLawFirm(iFirmPos).Item("FirmName").ToString .Columns("CreationDate").DefaultValue = Date.Today .Columns("LastUpdate").DefaultValue = Date.Today .Columns("StartDate").DefaultValue = Date.Today End With Console.WriteLine("Before: " & BindingContext(dsArbiters, tnArbiter).Position.ToString) BindingContext(dsArbiters, tnArbiter).AddNew() Console.WriteLine("After: " & BindingContext(dsArbiters, tnArbiter).Position.ToString)
Now the console writelines show the position gets incremented but any referencing to new row fails.
I've been pulling my hair out on this one... anyone have any insight?
~/<at
~~~~~~~~~~~~~~~
There is a certain satifaction in living a life in complete and total failure.
- Edward Abbey




Reply With Quote