1.  Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown

 

2.  If e.KeyCode = Keys.Enter Then

 

3.       Dim qapair As XmlElement = doc.CreateElement("qapair")

4.       Dim question As XmlElement = doc.CreateElement("question")

5.       Dim answer As XmlElement = doc.CreateElement("answer")

6.   

7.       question.InnerText = txtQuestion.Text

8.       answer.InnerText = txtAnswer.Text

9.   

10.      qapair.AppendChild(question)

11.      qapair.AppendChild(answer)

12.  

13.      doc.DocumentElement.AppendChild(qapair)

14.  

15.      doc.Save(strXMLFilename)

 

16.  

17.      TextBox1.Text = ""

18.      TextBox2.Text = ""

19.      TextBox1.Focus()

 

20.  End If

 

21. End Sub