Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello
I was making a password manager , and i want to save files as new file types (they are text files (encrypted with my own encryption) and new extension ".dbz") so i can create file.
using :_
My.Computer.FileSystem.WriteAllText(String.Concat(location, "try.dbz"), final, True)

but i have problem that it keeps adding my new data to original data while writing , i want it to clear all data in file first and then write new data

how can i do that , or can i simply delete old file with code and then create a new file again
thank you
Posted
Comments
Sergey Alexandrovich Kryukov 19-Jul-13 23:48pm    
One of the languages capable of using WPF is VB.NET, but it hardly can be called "VB".
—SA

1 solution

You could use a FileStream and use the Truncate method, then write new data to it.
 
Share this answer
 
v2

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