0
我有以下的VB.NET代碼,並期待combobox1的內容被寫入到XML文件,但它什麼都不?寫組合框選定的項目到XML文件
'Creating XML file first...
Dim objWriter As New System.IO.StreamWriter(IO.Directory.GetCurrentDirectory & "\PROFILE.xml")
objWriter.WriteLine("<COMPELATION>")
objWriter.WriteLine("</COMPELATION>")
objWriter.Close()
'Writing XML content...
Dim xmldoc As XmlDocument = New XmlDocument()
xmldoc.Load(IO.Directory.GetCurrentDirectory & "\PROFILE.xml")
With xmldoc.SelectSingleNode("/COMPELATION").CreateNavigator().AppendChild()
.WriteStartElement("DATA")
.WriteElementString("PROJECTID", TextBox1.Text)
.WriteElementString("CLIENTID", ComboBox1.SelectedText)
.WriteElementString("CDATE", Date.Today)
.WriteElementString("CTIME", Now.ToShortTimeString)
.WriteEndElement()
.Close()
End With
xmldoc.Save(IO.Directory.GetCurrentDirectory & "\PROFILE.xml")
Dim filepath As String = (IO.Directory.GetCurrentDirectory & "\PROFILE.xml")
Dim DS_PROJECTS As New DataSet
DS_PROJECTS.ReadXml(filepath)
End If