I've had several posts about this project I'm working on. But I'm finally getting pretty close, and abandoned the previous way in which I was attempting this.
I have a couple text boxes and when you click the button next to them, those values are transferred into the repeating table. That is working, but what's happening is that the first time it creates two identical lines. Then the second time it adds the 3rd line with the correct value but changes the first line to those values as well.
For example, if I enter John Doe in the txt boxes (assume txt box one is First_Name, and txt box two is Last_Name). I click add, then I have two lines with John Doe.
Then I enter Jane Doe and click the button. I have Jane Doe added to the third line, the first line is changed to Jane Doe and line two still says John Doe.
Here is my code for the button. I'm sure I have code that shouldn't be there and others that should be there isn't. Please help! Thanks in advance!
Background info: The form was started in 2007 and I'm now using 2010.
Public Sub btnAddItem_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
'Try
Dim blankValue As String = ""Dim addXpath As XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields", NamespaceManager)
Dim addWOField As XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:addWO", NamespaceManager)Dim addSerialField As XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:addSerial", NamespaceManager)
Dim row As XPathNavigator = Me.CreateNavigator().SelectSingleNode("/my:myFields/my:group1", NamespaceManager)
Dim newRow As XPathNavigator = Me.CreateNavigator().SelectSingleNode("/my:myFields/my:group1/my:group2", NamespaceManager)
row = row.Clone()
newRow.SelectSingleNode("my:woNum", NamespaceManager).SetValue(addWOField.Value)newRow.SelectSingleNode("my:serial", NamespaceManager).SetValue(addSerialField.Value)
row.AppendChild(newRow)
CurrentView.SelectText(addWOField)
'Catch ex As Exception
' MessageBox.Show(ex.Message)'End Try
End Sub