Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BindingManagerBase issue/Data binding

Status
Not open for further replies.

Kenny62

Programmer
Mar 3, 2004
54
GB
BindingManagerBase issue

I have a strange problem in using databinding - i wonder if anyone can help.
Briefly - i have a class with a dataset and all associated code to update the DS.
The UI form gets a reference to the DS and controls are bound to the fields in the DS.
When i add a new record i do the following:(Note: i'm using a strongly typed datset)


m_Bmb.EndCurrentEdit()
DTOrders = OrderDS.Orders
Debug.WriteLine("Before Add: " & DTOrders.Rows.Count.ToString)
'Create new row with same schema...
DR = DTOrders.NewOrdersRow
DR.CustomerID = "XXX" 'Dummy value
DR.EmployeeID = 1 'Dummy value

'???
Debug.Write("OID::" & DR.OrderID.ToString & vbCr)
DTOrders.AddOrdersRow(DR)
Debug.WriteLine("Afer Add: " & DTOrders.Rows.Count.ToString)

m_Bmb.Position = m_Bmb.Count - 1

ClearFields()

For some reason "m_Bmb.Position" doesn't advance to the last record of the DS - the newly added record. It doesn't change value. Any idea why...
Thanks for any help in advance
 
To move to the last Row...
oCurrencyManager.Position = oCurrencyManager.Count
and not count-1


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Thanks for the suggestion - however i'm forget to state that i'm using BindingManagerBase - i've followed examples in MSDN etc
I've setup BindingManagerBase as below...

Private WithEvents m_Bmb As BindingManagerBase
.
.
.
'bind control etc...
.
.
.
'Save a reference to the BindingManagerBase object.
m_Bmb = Me.BindingContext(TheDS.Tables("Orders").DefaultView)
'Force a refresh
m_Bmb.Position = m_Bmb.Count
m_Bmb.Position = 0

.
.
.
Navigate to first record, last, prev, next record - code all works as expected. But if i add a new record , m_Bmb.Count is updated but when i do the assignement, m_Bmb.Position = m_Bmb.Count,

m_Bmb.Position doesn't change - any idea why.

I hope this additional info is helpful. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top