Hi, I have a settings file in my application that saves a few things. I created a XML reader to read the document when the program starts.

I am now trying to figure out how to write the settings back to the file when the program shuts down.

I'm not sure how to do it so I haven't been able to write any code yet. The problem I'm having is I want to replace the existing settings with new settings and I do not want to write over the rest of the file. There are many settings in here for my user interface. I've been looking on MSDN and MS stated that it does not automatically check for existing settings or duplicate nodes.

Here is a sample of my setting file

Code:
<Settings>
<Window-height>557<Window-height>
<Window-width>413<Window-width>
<Window-maximized>FALSE<Window-maximized>
<Sequence>358911<Sequence>
<Settings>
This file only stored UI settings. When I close the form I want to save data into height and width and replace that existing data not create new nodes. I also want to ignore the secquence node or any other nodes because I don't need to save this data now but I don't want it overitten either.

When loading I used the XMLDocument.SelectSingleNode but it appears I cannot use that for saving.

Does anyone know the correct code to do this?