© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•7mo ago•
5 replies
tro

File Apparently Not Closing Properly

I've tried so many different things to get this working but it just won't. I want to read the information from a file and then overwrite it. I tried approaching this by just opening and reading the file, and closing the file. Then just overwrite it. In theory that should work, but for whatever reason it decides it doesn't want to work. It says it's still being used by another process and I've tried using the dispose method but I run into the same issue. This is the current state of my code, I just want to know why I can't overwrite the text file after reading it (even though it should have closed the file before opening it back up to overwrite it), and how I would fix that.
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Apparently the file thats right there does not exist???
C#CC# / help
14mo ago
.resx does not properly generate Design-File
C#CC# / help
2y ago
✅ file path not saving properly with id
C#CC# / help
3y ago
Mobile Application not deploying properly
C#CC# / help
3mo ago