﻿<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developers.de/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx<description>Have you ever written a mobile application using .NET compact framework and tried to use config files? I think there are many scenarios where you want to have a configurable mobile application. So I can&amp;rsquo;t understand why Microsoft hasn&amp;rsquo;t implemented</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#1230503<pubdate>Wed, 25 Feb 2015 12:08:41 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1230503</guid><dc:creator>Sanya S</dc:creator><description>&lt;p&gt;Thanks, this is quite simple and good.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1230503" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#986950<pubdate>Wed, 16 Apr 2014 14:33:11 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:986950</guid><dc:creator>Ezgi Keçici</dc:creator><description>&lt;p&gt;Thank you so much Alehmann. This code is really good and helpful.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=986950" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#986951<pubdate>Wed, 15 Jan 2014 12:35:36 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:986951</guid><dc:creator>Marcelo Casamassa</dc:creator><description>&lt;p&gt;Congrats this is very useful...&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=986951" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#986952<pubdate>Wed, 15 Jan 2014 03:59:05 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:986952</guid><dc:creator>bcd</dc:creator><description>&lt;p&gt;This implementation is pretty usefull and for Jack as Fernando said, you need to set &amp;quot;Copy allways&amp;quot; in the Copy output directory property for that file and also you need to set Build Action as &amp;quot;Content&amp;quot;.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=986952" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#523137<pubdate>Thu, 28 Mar 2013 15:54:59 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:523137</guid><dc:creator>Jay</dc:creator><description>&lt;p&gt;Thank you. This was helpful. &amp;nbsp;I made a mistake by placing comments in the app.config file. &amp;nbsp;The parsing logic cound not handle this. &amp;nbsp;Once I removed my comments the logic worked great. &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=523137" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#523090<pubdate>Wed, 20 Feb 2013 06:12:02 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:523090</guid><dc:creator>Rizky Zulkarnaen</dc:creator><description>&lt;p&gt;I&amp;#39;m facing type load exception error when implement this&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=523090" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#448405<pubdate>Fri, 12 Oct 2012 11:04:32 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:448405</guid><dc:creator>anil</dc:creator><description>&lt;p&gt;hi i am very thankful to you for this.&lt;/p&gt;
&lt;p&gt;Because i am trying for this for a long time. And now i am able to store my app settings but there is another problem i am facing when i want to update . i Tried many of the codes from the forums it is executing successfully but the file is not updating. So can you please provide me how to update the xml file from my code. please please help me on this&lt;/p&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;Anilkumar&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=448405" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#300048<pubdate>Wed, 29 Feb 2012 11:32:35 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:300048</guid><dc:creator>Martin Milan</dc:creator><description>&lt;p&gt;Just a quick note to say thanks for this... I was about to implement something similar in my lunch break, but this is pre-written and will do the job I have in mind...&lt;/p&gt;
&lt;p&gt;As others have said, the lack of Configuration on CF is a big oversight on MS&amp;#39;s part. I&amp;#39;ve only worked with CF for a few months, and I have been amazed how limited it is in terms of memory, and missing &amp;quot;really basic bits&amp;quot; - like TryParse methods on various types etc. Yes, ok, you can easily reimplement a lot of bits yourself, but you SHOULDN&amp;#39;T HAVE TO...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=300048" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#300049<pubdate>Mon, 20 Feb 2012 00:16:09 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:300049</guid><dc:creator>Jordi</dc:creator><description>&lt;p&gt;And the function that saves the settings in vb...&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Shared Sub Save()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim configFile As String = Assembly.GetExecutingAssembly.GetName.CodeBase &amp;amp; &amp;quot;.config&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Not File.Exists(configFile) Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Throw New FileNotFoundException(String.Format(&amp;quot;Application configuration file &amp;#39;{0}&amp;#39; not found.&amp;quot;, configFile))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim xmlDocument As New XmlDocument&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xmlDocument.Load(configFile)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName(&amp;quot;appSettings&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For i As Integer = 0 To Settings.Count - 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim sKey As String = Settings.GetKey(i)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim sValue As String = Settings.Get(i)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim bFound As Boolean = False&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim node As XmlNode&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each node In nodeList&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim key As XmlNode&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each key In node.ChildNodes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If key.Attributes.ItemOf(&amp;quot;key&amp;quot;).Value = sKey Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;key.Attributes.ItemOf(&amp;quot;value&amp;quot;).Value = sValue&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bFound = True&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Exit For&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If bFound Then Exit For&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Not bFound Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim elem As XmlElement&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim attr As XmlAttribute&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;main node&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;elem = xmlDocument.CreateElement(&amp;quot;add&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;attr = xmlDocument.CreateAttribute(&amp;quot;key&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;attr.Value = sKey&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;elem.Attributes.Append(attr)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;attr = xmlDocument.CreateAttribute(&amp;quot;value&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;attr.Value = sValue&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;elem.Attributes.Append(attr)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xmlDocument.SelectSingleNode(&amp;quot;//appSettings&amp;quot;).AppendChild(elem)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xmlDocument.Save(configFile)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=300049" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#300055<pubdate>Thu, 05 Jan 2012 04:33:58 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:300055</guid><dc:creator>Yanz</dc:creator><description>&lt;p&gt;how to use in VB.net?&lt;/p&gt;
&lt;p&gt;string userName = MobileConfiguration.Settings[&amp;quot;UserName&amp;quot;];&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=300055" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#300053<pubdate>Wed, 03 Aug 2011 05:37:21 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:300053</guid><dc:creator>Surendar</dc:creator><description>&lt;p&gt;Thanks a lot it worked:(&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=300053" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#42954<pubdate>Sat, 16 Apr 2011 10:29:43 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:42954</guid><dc:creator>Fernando</dc:creator><description>&lt;p&gt;Thank you very much. &amp;nbsp;I know this comment is a bit late, but I just started working with mobile devices, and was surprised to find no support for app.config on the .net CF.&lt;/p&gt;
&lt;p&gt;@Jack: &amp;nbsp;As someone on the comments mentioned, set the Copy to Output directory property to newer or always and that should solve your problem.&lt;/p&gt;
&lt;p&gt;Fernando.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=42954" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#42860<pubdate>Wed, 26 Jan 2011 16:06:30 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:42860</guid><dc:creator>Jack</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When I tried to implement the same code in Window Mobile device 6 Professional, I had problem in deploying the Simulator. The error saying &amp;quot;Application configuration file &amp;#39;\Program Files\Test_App\app.config&amp;#39; not found.&amp;quot;&lt;/p&gt;
&lt;p&gt;Can someone help me out?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jack&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=42860" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#28679<pubdate>Wed, 22 Dec 2010 18:52:20 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:28679</guid><dc:creator>Andres</dc:creator><description>&lt;p&gt;Excelent,&lt;/p&gt;
&lt;p&gt;thanks a lot, I only do a modification for &amp;quot;ConnectionStrings&amp;quot; &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=28679" width="1" height="1"&gt;</description></item><item><title>re: A simple implementation of config files for windows mobile</title><link />http://developers.de/blogs/andreas_lehmann/archive/2009/05/26/a-simple-implementation-of-config-files-for-windows-mobile.aspx#28543<pubdate>Mon, 13 Dec 2010 13:55:42 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:28543</guid><dc:creator>Gregory</dc:creator><description>&lt;p&gt;Thanks a lot!:)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=28543" width="1" height="1"&gt;</description></item></channel></rss>