2
Answers

Application Configuration File Error

I have attempted to use an XML Application Configuration File, but am getting the followin error: Error loading XML file file:///D:/Test/bin/Debug/Test.exe.config 'XML' is an invalid name for a processing instruction. Line 1, position 3. (D:\Test\bin\Debug\Test.exe.config) Has anyone encountered this problem before? I am unable to resolve the issue, and am beginning to wonder if its a glitch within VS 2002. My XML file 'Test.exe.cofig' is as follows: My code is as follows: using System.Collections; using System.Configuration; using System.Windows.Forms; namespace Test { public class Form1 : Form { private Button btn1; [STAThread] static void Main() { Application.Run(new Form1()); } private void btn1_Click(object sender, System.EventArgs e) { try { MessageBox.Show("Keys Count: " + ConfigurationSettings.AppSettings.Count.ToString()); } catch (Exception e) { MessageBox.Show(Main.Message); } } } }
Answers (2)