VB.Net: Importing DataGridView Data into XML Schema

Experts, I have a DataGridView and XML schema loaded into memory and saved as an XML file.

Please help me be able to import the data from the DataGrid into the XML schema and then saved to file.

So ideally the user would fill-in the datagrid with a few rows of information.   Then they would click a "next" button, which needs to import the datagrid data into an XML schema and file.

DataGridView Details:
Name: modlibDG
Column names: modname, modtype, modacvmm, modnostrs, modpop

XML Schema:...snippet below: (note the variables in each node equal the DataGridView columns, but that isn't working as I hoped and that's partly what I need your help with)

Thank you very much for any help!!!

Dim myXml = <?xml version="1.0"?><Dataset>
                        <ModuleLibrary NAME=<%= Me.modname %> TYPE=<%= Me.modtype %> ACVMM=<%= Me.modACVMM %> STORES=<%= Me.modNoStrs %> POPULATION=<%= Me.modPop %>>
        My.Computer.FileSystem.WriteAllText(datasetinstallpathVAR & "\" & datasetnmVAR & ".xml", myXml.ToString, False)

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I would create a Typed dataset that matches your schema specs and set it to display in your DataGridView. Reading & Writing to an xml file at that point is as simple as:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adamchicagoAuthor Commented:
Tommy11b,  thank you for your response...sorry about the delay, but I had a big family event over the weekend and couldn't break away for any coding.

Can you help me create a dataset to do this.  I think I've scratched the surface on building datasets but am totally confused when it comes to loading them with more than one row of data.

It would consist of one table with the above listed columns.  The rows would be filled by the datagridview...but on average shouldn't consist of more than 10-20 rows.

Thanks again!!

adamchicagoAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.