[C#] Eingaben Speichern ?

r_legend

Grünschnabel
Ich will Textbox eingaben speichern. Diese Gespeichere Eingabe soll beim nächsten Programmstart automatisch geladen werden.
Nun wollte ich erstmal einen wert aus einer xml datei auslesen.
Code:
private void Form1_Load(object sender, System.EventArgs e)
{
string handel = ConfigurationSettings.AppSettings["handel"];
txthandel.Text = handel;
}

in den Appsettings.config steht:

<configuration>
<appSettings key="handel" value="10" \>
</appSettings>
</configuration>

wenn ich jetzt das Programm starte steht in dem textblock feld nichts.
Kann mir einer weiterhelfen?
 
dann gibt der mit folgenede Fehlermeldung:
Code:
System.Configuration.ConfigurationException: Unbekanntes Attribut 'key' (H:\Schule\Höller\c#\K-syn\WindowsApplication1\bin\Debug\WindowsApplication1.exe.config line 3)

und wenn ich den \ wegmache kommt
Code:
System.Configuration.ConfigurationException: Unbekanntes Attribut 'key' (H:\Schule\Höller\c#\K-syn\WindowsApplication1\bin\Debug\WindowsApplication1.exe.config line 3)
 
Ah, ich dummes dummes Wiesel.

Code:
<configuration>
	<appSettings>
		<add key="key1" value="key1 value" />
		<add key="key2" value="key2 value" />
		<add key="key3" value="key3 value" />
	</appSettings>
</configuration>

So muss das aussehen. :)
 
Zurück