Click here to Skip to main content
15,923,168 members
Home / Discussions / C#
   

C#

 
GeneralRe: TextBox calculations on the fly. Pin
..Hubert..3-May-04 1:17
..Hubert..3-May-04 1:17 
GeneralRe: TextBox calculations on the fly. Pin
Heath Stewart3-May-04 1:52
protectorHeath Stewart3-May-04 1:52 
GeneralRe: TextBox calculations on the fly. Pin
..Hubert..4-May-04 7:51
..Hubert..4-May-04 7:51 
GeneralRe: TextBox calculations on the fly. Pin
Heath Stewart4-May-04 8:04
protectorHeath Stewart4-May-04 8:04 
GeneralArray and form Pin
brugi821-May-04 23:20
brugi821-May-04 23:20 
GeneralRe: Array and form Pin
leppie2-May-04 0:54
leppie2-May-04 0:54 
GeneralRe: Array and form Pin
Dave Kreskowiak2-May-04 4:36
mveDave Kreskowiak2-May-04 4:36 
GeneralRe: Array and form Pin
thomasa2-May-04 22:23
thomasa2-May-04 22:23 
GeneralRe: Array and form Pin
brugi823-May-04 1:10
brugi823-May-04 1:10 
GeneralHiding Toolbar Pin
Mazdak1-May-04 21:10
Mazdak1-May-04 21:10 
GeneralRe: Hiding Toolbar Pin
Stefan Troschuetz1-May-04 21:46
Stefan Troschuetz1-May-04 21:46 
GeneralRe: Hiding Toolbar Pin
Mazdak1-May-04 22:09
Mazdak1-May-04 22:09 
GeneralRe: Hiding Toolbar Pin
Heath Stewart2-May-04 6:39
protectorHeath Stewart2-May-04 6:39 
GeneralRe: Hiding Toolbar Pin
Mazdak2-May-04 8:31
Mazdak2-May-04 8:31 
GeneralRe: Hiding Toolbar Pin
Heath Stewart2-May-04 8:51
protectorHeath Stewart2-May-04 8:51 
GeneralRe: Hiding Toolbar Pin
Mazdak2-May-04 8:56
Mazdak2-May-04 8:56 
GeneralRe: Hiding Toolbar Pin
Heath Stewart2-May-04 8:59
protectorHeath Stewart2-May-04 8:59 
GeneralRe: Hiding Toolbar Pin
Mazdak2-May-04 9:47
Mazdak2-May-04 9:47 
GeneralRe: Hiding Toolbar Pin
Mazdak2-May-04 9:57
Mazdak2-May-04 9:57 
GeneralRe: Hiding Toolbar Pin
Heath Stewart2-May-04 10:18
protectorHeath Stewart2-May-04 10:18 
GeneralRe: Hiding Toolbar Pin
Mazdak2-May-04 21:11
Mazdak2-May-04 21:11 
GeneralRe: Hiding Toolbar Pin
Nick Parker2-May-04 5:02
protectorNick Parker2-May-04 5:02 
GeneralRe: Hiding Toolbar Pin
Mazdak2-May-04 5:16
Mazdak2-May-04 5:16 
GeneralRe: Hiding Toolbar Pin
Nick Parker2-May-04 6:10
protectorNick Parker2-May-04 6:10 
GeneralProblem with app.config and myfile.exe.config Pin
PEDRO_PASAMAR1-May-04 21:03
PEDRO_PASAMAR1-May-04 21:03 
Hello

I'm write a little class based on a sample from VB on VS Help to write values in the configuration file.

<br />
public static void SetStrAppSetting(string setting, string Value)<br />
{<br />
	System.Reflection.Assembly Asm = System.Reflection.Assembly.GetExecutingAssembly();<br />
	string strConfigLoc = Asm.Location;<br />
	string strTemp = strConfigLoc;<br />
	strTemp = System.IO.Path.GetDirectoryName(strConfigLoc);<br />
	System.IO.FileInfo FileInfo = new System.IO.FileInfo(strTemp + "\\" + Path.GetFileName(Application.ExecutablePath) + ".config");<br />
	System.Xml.XmlDocument XmlDocument = new System.Xml.XmlDocument();<br />
	XmlDocument.Load(FileInfo.FullName);<br />
<br />
	System.Xml.XmlNode CnfNode = XmlDocument["configuration"];<br />
	System.Xml.XmlNode AppSettingsNode = CnfNode["appSettings"];<br />
<br />
	foreach (System.Xml.XmlNode Node in AppSettingsNode)<br />
	{<br />
		if (Node.Name == "add")<br />
		{<br />
			if (Node.Attributes.GetNamedItem("key").Value == setting)<br />
			{<br />
				Node.Attributes.GetNamedItem("value").Value = Value;<br />
				break;<br />
			}<br />
		}<br />
	}<br />
<br />
	XmlDocument.Save(FileInfo.FullName);<br />
}<br />


The problem is that the code makes the right thing write values in myfile.exe.config, but the application loads the dynamic properties from the app.config of the project. How I can handle this ?

Thaks

Pedro E. Pasamar Vidal

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.