Database edit then save problem
Im trying to make a database and for the most part it works. The form1 has add new button (which goes into my form2 window that adds all of the information there, then I hit save, when I exit it and comes back to the form1, with everything saved. There is a listbox that shows all the names, then I click on anyone of the names and try to edit it and it works, then I hit the save button, it comes up with the error under
Me.TableAdapterManager.UpdateAll(Me.Assignment10DataSet)
am I doing something wrong or do I need to make an edit button, if so how do I code this
This is my form1 code
Public Class Form1
Private Sub ContactBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContactBindingNavigatorSaveItem.Click
First_nameTextBox.Enabled = True
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Assignment10DataSet.contact' table. You can move, or remove it, as needed.
Me.ContactTableAdapter.Fill(Me.Assignment10DataSet.contact)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Validate()
Me.ContactBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Assignment10DataSet)
MsgBox("Saved")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Validate()
Me.ContactTableAdapter.Delete(Me.First_nameTextBox.Text, Me.Last_nameTextBox.Text)
Me.ContactTableAdapter.Fill(Me.Assignment10DataSet.contact)
MsgBox("Deleted")
End Sub
End Class
and this the form2 code
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form1.ContactTableAdapter.Insert(Me.TextBox1.Text, Me.TextBox2.Text,
Me.TextBox3.Text, Me.TextBox4.Text,
Me.TextBox5.Text, Me.TextBox6.Text,
Me.TextBox7.Text, Me.TextBox8.Text,
Me.TextBox9.Text)
Form1.ContactTableAdapter.Fill(Form1.Assignment10DataSet.contact)
MsgBox("completed")
For Each item As Control In Me.Controls
If TypeOf item Is TextBox Then
item.Text = String.Empty
End If
Next
End Sub
End Class
could someone help me