Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Every One
I want some help for these problems , I make simple App read and write data from file , it is working with me in release and debug mood but when i make Setup package on Visual Studio , these Functions don't work and make App crash , so is there any solutions for this problem ?
I know the problem where is , StrmWrtie&StrmRead but i don't know why is it happen ? and what is the solution

C#
private void button1_Click(object sender, EventArgs e)
{
    string textbox1 = textBox1.Text;
    StreamWriter ss = new StreamWriter(Application.ExecutablePath+"test.text");
    ss.WriteLine(textbox1);
    ss.Dispose();
    MessageBox.Show("Write is Done");
    StreamReader sss = new StreamReader(Application.ExecutablePath + "test.text");
    string textbox2=sss.ReadLine();
    textBox2.Text = textbox2;
}


What I have tried:

Stack Ovrflow , MSDN , CodeProject
Posted
Updated 24-Jul-16 23:50pm

1 solution

Simple: you don't store data in your application folder because in production it is generally under the "Program Files" folder - and access to that is restricted for security reasons.
Instead, use one of the "approved" places to store information: Where should I store my data?[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900