Private Sub btnSalvar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSalvar.Click
'If thisDataSet Is Nothing Then
' Return 'End If
Dim thisDataSet As New DataSet
thisDataSet.Tables.Add(dtFuncs)
' Create a file name to write to.
Dim filename As String = "meuDocumentoXML.xml" ' Create the FileStream to write with. Dim myFileStream As New System.IO.FileStream _ (filename, System.IO.FileMode.Create) ' Create an XmlTextWriter with the fileStream. Dim myXmlWriter As New System.Xml.XmlTextWriter _ (myFileStream, System.Text.Encoding.Unicode) ' Write to the file with the WriteXml method. thisDataSet.WriteXml(myXmlWriter) myXmlWriter.Close() End Sub
Private Sub btnCarregar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCarregar.Click Dim meuDataset As New DataSet
' Read the XML document back in.
' Create new FileStream to read schema with. Dim fsReadXml As New System.IO.FileStream _ ("meuDocumentoXML.xml", System.IO.FileMode.Open) ' Create an XmlTextReader to read the file. Dim myXmlReader As New System.Xml.XmlTextReader(fsReadXml) ' Read the XML document into the DataSet. meuDataset.ReadXml(myXmlReader) ' Close the XmlTextReader myXmlReader.Close()