On load my program executes the following code to establish if an XML file already exists, and if not, creates one:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IO.File.Exists("Dictionary.xml") = False Then
Dim Dictionary As XDocument = <?xml version="1.0" encoding="utf-8"?>
<Root></Root>
MessageBox.Show("XML dictionary file created.")
End If
End Sub
I'm then trying to get user input from 4 textboxes to be appended to this xml file for each word. I've got so far, but can't find a good example of how to do this.
Private Sub Save_Data_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save_Data.Click
Dim Dictionary As XDocument = XDocument.Load("Dictionary.xml")
Dictionary.Add
<Word>
<English>Textbox1.Text</English>
<Transcription>Textbox2.Text</Transcription>
<Meaning>Textbox3.Text</Meaning>
<Sound>Textbox4.Text</Sound>
</Word>
End Sub