Configファイルのデータをプログラムコードから読み込む方法を紹介します。
VisualStudioを使ってプログラムを書いている方向けです。
Configファイルへのデータ入力
1.ソリューションエクスプローラーから、“App.congig”を選択します。

※ソリューションエクスプローラーが表示されていない方は、[Ctrl]、[Alt]、[L]を同時押しして表示させてください。
2.下記の箇所に、“<appSettings>”タグを記述します。

3.下記の画像を参考に、1.2で記述した“<appSettings>”タグの中に<add>タグを記述してください。<add>タグの中には、key属性とvalue属性を入れ、これらの属性にプログラムコードから取得させたい値を入力しておきます。

アセンブリ参照(dll参照)の追加
1.ソリューションエクスプローラーの”参照”を右クリックし、[参照の追加(R)…]をクリックしてください。

2.下記の画像を参考に、“System.Configuration”の左横にチェックをつけ、[OK]をクリックしてください。

プログラムコードの記述
ConfigurationManager.AppSettings.AllKeysメソッドを使用してConfigファイルの内容を読み込むことができます。
Congifから読み込んだデータは、Dictionaryを使うと扱いやすいです。
System.Collections.Generic.Dictionary<string, string> SetConfig = new System.Collections.Generic.Dictionary<string, string>();
foreach (string key in System.Configuration.ConfigurationManager.AppSettings.AllKeys)
{
SetConfig.Add(key,System.Configuration.ConfigurationManager.AppSettings[key]);
}
foreach (System.Collections.Generic.KeyValuePair<string, string> pair in SetConfig)
{
//取得したデータをメッセージボックスで表示します。
//ここは適宜修正して使用してください。
MessageBox.Show(pair.Key + " : " + pair.Value);
}
Dim SetConfig As System.Collections.Generic.Dictionary(Of String, String) = New System.Collections.Generic.Dictionary(Of String, String)
For Each key As String In System.Configuration.ConfigurationManager.AppSettings.AllKeys
SetConfig.Add(key, System.Configuration.ConfigurationManager.AppSettings(key))
Next
For Each pair As System.Collections.Generic.KeyValuePair(Of String, String) In SetConfig
'取得したデータをメッセージボックスで表示します。
'ここは適宜修正して使用してください。
MessageBox.Show(pair.Key + " : " + pair.Value)
Next