Hello,
how I can access a DataSet and it's TablesData(s) to add/delete/edit rows from another class
I have a winform and I added a DataGridView dataGridView1 then I added a DataSet dataSet1 then I bind them with BindingSource
all the data will be saved in an XML
all work OK, I made few test projects all work fine
but when I try to test the possibility to add data row from another class, it dose not show the change on the DataGridView !!!!
so I have Form1 with dataGridView1 and dataSet1 both are public
within the other Class I did
var esf = new Form1();
DataRow pl = esf.dataSet1.Tables["MyItems"].NewRow();
pl["Type"] = type;
pl["Name"] = true;
esf.dataSet1.Tables["MyItems"].Rows.Add(pl);
and if I add
esf.dataSet1.WriteXml(esf.XmlSettingsFile);
it saves the file correctly!
but it over write other data
I feel like I'm working with another DataSet that is the same as my Original one in the Form
but I need to access the data in the original DataSet in the main Form
simply I need to have the dataSet1 as public static so I can access it and add edit data to it but when I do that, Visual Studio gives me error! in the visual View of the Form!?!
any suggestions