0
我有音樂播放列表信息,這些信息讀入到Visual Basic中的GridView控件現有的XML文檔。我現在想要將GridView中的所有更新保存到該xml文檔中。我怎樣才能做到這一點?如何在VB GridView控件更新保存到一個現有的XML文檔?
Private Sub cboUsers_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboUsers.SelectedIndexChanged
Dim songList As New XmlDocument
songList.LoadXml(s.GetPlaylist(cboUsers.SelectedItem.ToString()))
Grid.Rows.Clear()
Dim songs As XmlNodeList = songList.DocumentElement.SelectNodes("//Song")
Dim song As XmlNode
For Each song In songs
Dim artist As String = song.SelectSingleNode("artist").InnerText
Dim title As String = song.SelectSingleNode("title").InnerText
Dim length As String = song.SelectSingleNode("length").InnerText
Dim album As String = song.SelectSingleNode("album").InnerText
Dim popularity As String = song.SelectSingleNode("popularity").InnerText
Dim row() As Object = {artist, title, length, album, popularity}
Grid.Rows.Add(row) ' Add as a row in the Grid
Next
End Sub
感謝
我不熟悉C#,所以它不是那麼容易複製到VB對我來說...你能在VB提供一個例子嗎? – weedave 2009-12-14 13:19:41
完成,希望足以與之合作? – Jammin 2009-12-14 14:46:23