Click here to Skip to main content
15,746,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I have a Notepad made by me and it is like the real Notepad. If I save a text(with Save As) then I modify it and I press Save, an error appears: "The process cannot access the file because it is used by another process". The code from the Save button is this:
StreamWriter sw = new StreamWriter(loc);
     sw.Write(richTextBox1.Text);
     sw.Close();

Where loc is the text location.
What is wrong? Can you tell me the correct code?
Posted
Updated 6-Dec-09 9:59am
v2

1 solution

You would have connected to your file while you get its text to show in the textbox. See if you are closing that or not.
 
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