Saving XML Data From Visual Basic

After you make changes to the data loaded from an XML file either manually or programmatically, you may want to save the changes back into the XML file. Example program EditXml is similar to program ReadXml except it allows you to save changes to a modified XML file.

Example program EditXml uses the code in Listing 7.8 to display XML data and save changes. The heart of the program is the DataSet object’s WriteXml method, which saves data into an XML file. To ensure that no changes are lost, however, program EditXml must do more than simply calling WriteXml.

When the user selects the File menu’s Open command, the program’s mnuFileOpen_Click event handler calls the DataSafe function. DataSafe returns True if ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.