matejkralik 0 Newbie Poster

Hey people, I want to ask.

I have following xml file:

<Materials>
<Material hrubka="5" popis="dobry popis" />
<Material hrubka="0,2" popis="bla bla" />
<Material hrubka="0,1" popis="bla bla" />
</Materials>

I fill datagridview with this xml file. This file is automatically saved when the application is closed. I have a problem, when I delete in my program, in the table all rows, that means I delete all nodes ("material"), then I have a problem when starting program again and loading data:

XmlDataDocument xmlDatadoc = new XmlDataDocument();
xmlDatadoc.DataSet.ReadXml("data.xml");
dataSet1 = xmlDatadoc.DataSet;
Tabulka_DataGridView.DataSource = dataSet1.DefaultViewManager;
Tabulka_DataGridView.DataMember = "Material";
the last line is error then, because system doesn't catch "Material"

I need to estabilish something that will help me to set columns, or something like blank nodes "Material" with blank tables, no rows, that will enable user to add new rows in to table and followingly save to xml file.

Hope, my description was not complicated.

pls, I need your advice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.