I have everything done, but I forgot one simple little thing, how to save the database to a textfile, I have two forms with this application, the first one has all the information in it (textboxes) and a listbox in it to see all the contacts, then the second form has all the textboxes (contact ID, First name, Last name, telephone, address, city, zip code, and email) that the user can put information in and hit add item to add it, it has a save button that will save it to the application, but I forgot to add a save button so it saves to a text file and loads from a text file, if anyone knows how to do a database could you help me out
This is my code for form1
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
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End Sub
End Class
and this is for form2
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