Hi,

Im new to C# and need help with my program that im writing i need to let it read an XML in the first window and when i press add program a second window opens (both windows i have) i want it to write the XML so something like this (as you click on add) would come out.

<?xml version="1.0" encoding="utf-8"?>

<prog>

	<id=1>
		<name>Dreamweaver</name>
		<path>C:\Program Files\Adobe\Adobe Dreamweaver CS4\Dreamweaver.exe</path>
	</id>
	
	<id=2>
		<name>Photoshop</name>
		<path>C:\Program Files\Adobe\Adobe Photoshop CS4\Photoshop.exe</path>
	</id>
	
</prog>

then when the XML is adjusted that a button is made with on click it would do

Process.Start(@"D:\Program Files\Adobe\Adobe Dreamweaver CS4\Dreamweaver.exe");

If someone could help me on how to do this cause i already looked at the read & write tutorials on the web but cant get a real good grip on how to do it.

thx in advance

I'm afraid I don't understand what you're asking. What I think you're asking is:

When the program opens up the main form will let you select an XML file and open it. You want a list of the programs in the XML file to appear on the main form after you open up the XML file with a "Run" button next to each program that will run Process.Start().

Next you want a button on the main form to "Add" a new program where it will let you select a file and give a user typed name for it. After they add the program it will add the information to the XML file and save it.

Let me know if this is the intended design

When the program opens up the main form will let you select an XML file and open it.

No the XML file is predefined it nsacfg.xml

You want a list of the programs in the XML file to appear on the main form after you open up the XML file with a "Run" button next to each program that will run Process.Start().

not realy i want to let the app to read the XML Tags i have and use it to change the text that is in the button and the attach the path to the Process.Start() so when you click on the button it would start the program

Next you want a button on the main form to "Add" a new program where it will let you select a file and give a user typed name for it. After they add the program it will add the information to the XML file and save it.

Yes that is correct but this button already exists and i can go to the second window all the information i want is how to let it write to to XML from the second window with the correct TAG's, then let the first window read the XML and edits the button so that instead of EXAMPLE: the text is app it would read the TAG name and rename the button to that TAG and edit Process.Start() to Process.Start(@"D:\Program Files\Adobe\Adobe Dreamweaver CS4\Dreamweaver.exe"); for example

This article has been dead for over six months. Start a new discussion instead.