August 19, 2005

Failed to save settings

Error: Failed to save settings: An error occurred executing the configuration section handler for userSettings/XYZ.Properties.Settings. (C:\Documents and Settings\Administrator\Local Settings\Application Data\amastaneh\XYZ.exe_Url_znuhtk3o00xt5ahfq5tlsmqqiclldnz5\1

I had a big problem with this error because every thing came normal but i had one error on Settings.Default.Save() method.
I think that, You can correct this error from app.config file.
I know that you wanna say this file is OK but i must tell you that i was like you, too.
However, you can test this way.
In this way you can build a sample application and then go to app.config and copy/past some line form first.
You must compare these codes with your uncorrected app.config file.
This is a section of my corrected app.config file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XYZ.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" />
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XYZ.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
....
I hope this helps, Be happy.

August 18, 2005

Multilanguage Application

If you want to develope the Multi Language Application with newest Microsoft technology for supporting multi language feature then you can follow below:
New innovations in dot net technologies causes you not to need to add a new form for each language. You can have a form with multi configuration, image, and text … on interface.
Step 1: Insert New Form: Ctrl+Shift+A>WindowsForm
Step 2: Insert New Language: [On Form]RightClick>Properties>Design>Language>Select a new language like(French, Italy, US, Persian and ...)
Step 3: Insert New Language again: more and more...
Step 4: For Changing Languages you can use below
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-ES");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("it-IT");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fa-IR");
PS: this method is compatible with Microsoft .Net Framework 2.0 Beta 2 Compiler but I think that you can use this for old version and newest version of .net resealed.