soonerman1978
Programmer
This is a question that has baffled me for a few days now. I have researched and come up absolutely dry. So any help would be much appreciated!!!
To start I used the data form wizard to generate my form and insert the fields for the data for me. Everything works fine with the exception of the Add button. When I click Add, the numbers on the Navigation controls change, but it will not automatically position itself on the new record that was added. When I try to use the navigation controls to move to the record, it will not move to it. I would appreciate any help that would get me to that elusive new, blank record that I just added.
I have generated other forms with the wizard, and they work just fine. I have posted the code below.
To start I used the data form wizard to generate my form and insert the fields for the data for me. Everything works fine with the exception of the Add button. When I click Add, the numbers on the Navigation controls change, but it will not automatically position itself on the new record that was added. When I try to use the navigation controls to move to the record, it will not move to it. I would appreciate any help that would get me to that elusive new, blank record that I just added.
I have generated other forms with the wizard, and they work just fine. I have posted the code below.
Code:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim dr As DataRow
Try
'Clear out the current edits
Me.BindingContext(objdsWorkOrders, "WorkOrders").EndCurrentEdit()
Me.BindingContext(objdsWorkOrders, "WorkOrders").AddNew()
Catch eEndEdit As System.Exception
System.Windows.Forms.MessageBox.Show(eEndEdit.Message)
End Try
Me.objdsWorkOrders_PositionChanged()
End Sub
Private Sub objdsWorkOrders_PositionChanged()
Me.lblNavLocation.Text = (((Me.BindingContext(objdsWorkOrders, "WorkOrders").Position + 1).ToString + " of ") _
+ Me.BindingContext(objdsWorkOrders, "WorkOrders").Count.ToString)
End Sub