Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Append to xml file

Is there a way to read an XML file and then "append" a line to it with vb code?

Example...on a button click event, could I add this
<add key="strCon" value="user id=lrbrister;pwd=mypassword;data source=lrbrister_dell\;initial catalog=mydatabaser"/>


To this mysettings.config file
<appSettings>
  <add key="KeyToOverride" value="Overridden" />
  <add key="KeyToBeAdded" value="EntirelyNew" />
</appSettings>

So that the file would now look like this
<appSettings>
  <add key="KeyToOverride" value="Overridden" />
  <add key="KeyToBeAdded" value="EntirelyNew" />
  <add key="strCon" value="user id=lrbrister;pwd=mypassword;data source=lrbrister_dell\;initial catalog=mydatabaser"/>
</appSettings>
Avatar of binaryevo
binaryevo
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of nepaluz
nepaluz
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

Bewst "clean" answer