vb プロジェクトから XML ドキュメントにデータを書き込んでいます。データを思い出すと、以前のすべてのメモが 1 行の長いテキストとして戻ってきます。XML ドキュメントへの送信によって行を分割するにはどうすればよいですか?
コード:
Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
Dim AcctNum = txtAcctNum.Text.ToString
'Dim note1 As String = ""
'Dim linebreak As String = "<br />"
'Str & VBNewLine
'Str & VBCrLf
Dim note2 As String = TxtNotes.Text
'note2(0) = vbNewLine
'note2(1) = TxtNotes.Text()
Dim note3 As String = txtPastNote.Text
note2 = note3 + "\n" + note2
Dim root As XElement = XElement.Load("CreditApp.xml")
Dim customer = From el In root.<custData>
Where el.<AcctNum>.Value = AcctNum
Select el
For Each element In customer
element.SetElementValue("Note", note2)
Next
'Dim NewNote As String = note1 + note2
'Dim doc As New XmlDocument
'doc.Load("CreditApp.xml")
'Dim custData As XmlElement = doc.CreateElement("custData")
'Dim note As XmlElement = doc.CreateElement("Note")
'note.InnerText = NewNote
'custData.AppendChild(note)
'doc.DocumentElement.AppendChild(custData)
root.Save("CreditApp.xml")
MessageBox.Show("NOTES SAVE")
End Sub
XML から要素を取得するコード:
For Each element In customer
txtSSN.Text = element.ssn
txtfName.Text = element.fname
txtlName.Text = element.lname
txtAcctNum.Text = element.acctnum
txtVerfiWord.Text = element.passcode
txtAcctAmt.Text = element.acctAval
txtAcctBal.Text = element.acctbal
txtLPmtAmt.Text = element.lpmtamt
txtLPmtDate.Text = element.lpmtdate
txtGender.Text = element.gender
txtAddress.Text = element.address
txtCity.Text = element.city
txtState.Text = element.state
txtZip.Text = element.zip
txtPhone.Text = element.phone
txtEmail.Text = element.email
txtCreditLmt.Text = element.creditlim
txtIntRate.Text = element.intrate
txtMinPmtDue.Text = element.minpay
txtPmtDueDate.Text = element.pmtduedate
txtPastNote.Text = element.note
end sub