View Single Post
  #2 (permalink)  
Old November 30th, 2011, 11:33 AM
Rod Stephens's Avatar
Rod Stephens Rod Stephens is offline
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

Normally when you use data binding the control is bound to some object that has a notion of the current record. You need to figure out which record that is and make it move to a new record. That should update the value in the current record to whatever is in the TextBox.

If you want to create a new record, you need to call that object's AddNew method (or whatever method it provides for creating a new record). You then need to call it's Update method when you're done to accept the new record.

Overall I think data binding might be a little confusing for this. I would probably just use a SQL INSERT statement (or some other direct database method) instead of data binding to add the record when focus moves to the next field.

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote