Link to home
Start Free TrialLog in
Avatar of adamchicago
adamchicago

asked on

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 %>>
                        </ModuleLibrary>
                    </Dataset>
        My.Computer.FileSystem.WriteAllText(datasetinstallpathVAR & "\" & datasetnmVAR & ".xml", myXml.ToString, False)

Open in new window

Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER CERTIFIED SOLUTION
Avatar of Tommy11b
Tommy11b
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adamchicago
adamchicago

ASKER

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!!

Adam
Thanks