How do i get the file name on the second time?
<pre><code>public void Save(string path , bool Locked , PictureBox pb)
        {
            if (File.Exists(path + "\\" + "DATABASE" + "\\" + wo_name))
            {
                string fnexist = path + "\\" + "DATABASE" + "\\" + wo_name;
            }
            string fn = path + "\\" +"DATABASE" +"\\" + wo_name + "\\" + wo_name + ".txt";
            OptionsFile setting_file = new OptionsFile(fn);
        }
</code></pre>

<p>What i need is to check if the file wo_name exist  in the wo_name directory if so delete it and create there a new wo_name. But the second time i try to save the file the wo_name is now jonny.txt not only jonny as beofre. So now it will try to delete the file jonny.txt in the directory name jonny.txt and thats wrong. It should be jonny\jonny.txt </p>

<p>This is the full code of the function:</p>

<pre><code>public void Save(string path , bool Locked , PictureBox pb)
        {
            if (File.Exists(path + "\\" + "DATABASE" + "\\" + wo_name))
            {
                string fnexist = path + "\\" + "DATABASE" + "\\" + wo_name;
            }
            string fn = path + "\\" +"DATABASE" +"\\" + wo_name + "\\" + wo_name + ".txt";
            OptionsFile setting_file = new OptionsFile(fn);
            setting_file.SetKey("File Name", fn);
            setting_file.SetKey("Version", version);
            setting_file.SetKey("Button Lock", Locked.ToString());

            setting_file.SetKey("picturebox.Width", pb.Width.ToString());
            setting_file.SetKey("picturebox.Height", pb.Height.ToString());
                setting_file.SetListFloatKey("Coordinates_X", woc.Point_X);
                setting_file.SetListFloatKey("Coordinates_Y", woc.Point_Y);

                setting_file.SetListIntKey("ConnectionStart", connectionStart);
                setting_file.SetListIntKey("ConnectionEnd", connectionEnd);


        }
</code></pre>
