Reputation: 287
I currently have an application that looks like this, that reads data from an XML file and inserts it into a datagridview on my form
Now when I click on the notes button I have set it up so that it opens a new form, Form2 as pictured below, and takes with it the string that is within the notes column.
The textbox below my datagrid shows the Notes from whatever column has been click on/selected
Now what I want to do is be able to Enter new notes on form2 and click the OK button to save them to my datagrid, however I'm not quite sure how to do this as every example i've found uses an SQL example like this video here:
http://www.youtube.com/watch?v=P1pBUGblPKY
Any ideas?
This is how I have it set up so that the XML file fits into the datagrid, I have a feeling I need to re-use parts of this code on Form2 but i'm not sure, thanks!
private void Form1_Load(object sender, EventArgs e)
{
DataSet ds1 = new DataSet();
ds1.ReadXml("C:/blah/blah/testdemoxml.xml");
dataGridView1.DataSource = ds1.Tables[0].DefaultView;
Upvotes: 0
Views: 419
Reputation: 1411
Check out my tutorial on linq to xml. When the user clicks the ok button on form 2 you will need to update the XML file. Then you wil need to rebind the datagrid using dataGridName.DataBind();
You can see my tutorial here for Linq To Xml:
http://www.youtube.com/watch?v=20PK4fOzEZw
Upvotes: 2