EDN Admin
Well-known member
<pre class="prettyprint" style=" 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]
First time if its a new file the the variable wo_name is only a name without the .txt in the end for example: test
So i build the variable fn all paths including a sub path with the file name and then add txt in the end to create the file.
In the second time i check above if the File.Exists then wo_name is allready text.txt so when im doing
<pre class="prettyprint" style=" path + "\" + "DATABASE" + "\" + wo_name[/code]
In the second time it will be for example: c
ATABASEtest.txt but i need to check if the file exist so it should be like: c
ATABASEtesttest.txt
So how can i make the File.Exists to check for the file ? In the beginning i used the regular fn variable to check if the file exists but then it was :
c
ATABASEtest.txttest.txt.test.txt somethingl ike that. And it should be c
ATABASEtesttest.txt
*** When im saving to the same file second time i want to overwrite all over the file. Not adding from last point or something but overwrite if the file exist.
<
danieli
<br/>
View the full article
{
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]
First time if its a new file the the variable wo_name is only a name without the .txt in the end for example: test
So i build the variable fn all paths including a sub path with the file name and then add txt in the end to create the file.
In the second time i check above if the File.Exists then wo_name is allready text.txt so when im doing
<pre class="prettyprint" style=" path + "\" + "DATABASE" + "\" + wo_name[/code]
In the second time it will be for example: c


So how can i make the File.Exists to check for the file ? In the beginning i used the regular fn variable to check if the file exists but then it was :
c


*** When im saving to the same file second time i want to overwrite all over the file. Not adding from last point or something but overwrite if the file exist.
<
danieli
<br/>
View the full article