Hi,

I am using a DataSet to save my data into a .xml file and then read this data.

My program has several Windows forms, the idea is each one will be a Datatable in my DataSet.

I created Datatable1 to the firsr form. So far it is all good. I can save the data, and ready it back to the form.
My problem is when I also try to save a second Datatable2, that belongs to my DataSet and has a relation with the first one.

The idea is: Datatable1 works in one form, after saving the information, I jump to a second windows form, and then I also save the data the DataTable2 into the same XML file that I have already created. But, instead of adding information in the XML file, it is replacing the data from the DataTable1 for one in the Datatable2.

I know I am doing something wrong, but I could not understand yet how to manage it.

Some help would be great.

-- The code I use to save is: ( I used the property DataBiding to conect the controls with the datatable)

Code:
DataTable1BindingSource.EndEdit()
DataSeta.DataTable1.Rows.Add()

        Try
            DataSet.WriteXml(myXMLFilePath)
            MsgBox("Data Saved Successfully!")
  
        Catch ex As Exception
            MsgBox("Something went wrong.. Erro: " & ex.ToString)
        End Try
I am using this same code to both forms. I do not know if the problem is in this, or in the relation itself.


I appreciate the help.