Monday, February 04, 2013 9:44 PM
OK, I want to use the BindingSource.AddingNew event to create a new database row and automatically fill in some of the feilds before the user enters in the data. For example, I would like to fill in an automatically generated id...things like that. The feilds that I enter in manually the user will not have access to on the form.
However, I don't know how to create a new row and assign it to the e.NewObject of the AddingNewEventArgs event handler.
Any help is greatly appreciated. I want my routing to look something like this, but it's not working and I can't think of an alternative.
Public Sub VenderBindingSource_AddingNew(ByVal sender as Object, ByVal e as AddingNewEventArgs) Handles VenderBindingSource.AddingNew ' get error, can't just create a new row Dim theNewRow as New DataRow() theNewRow.Row.Item(0) = 39233 e.NewObject = theNewRow End Sub
Monday, February 04, 2013 9:53 PM
Just found this thread: http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/8d788612-e7fd-4ef3-b471-e4b857e96c99
I am going to try that next. I think this will work. Sorry for cross-threading...ERROR.
- Marked As Answer by Fanny LiuMicrosoft Contingent Staff, Moderator Monday, February 11, 2013 9:38 AM