c# - Release file from RichtextBox LoadFile Method -
so, load file @ start of form. have "save button" in form.when click it, want overwrite file richtextbox.savefile method. "access path.. denied"
i checked , got this:
- permissions current user granted
- the debug folder has "read-only" -- tried remove, come
now, think program doesn't release resource(the file) when close form
is there method force this? (i think file remains loaded ram memory)
one more thing: must use savefile , loadfile methods. working rtf files , code in such way methods best job.
public editarearticol(string path,list<capitol>chapters,object[,]lca) { this.richtextboxex1.loadfile(path, richtextboxstreamtype.richtext); } private void savetoolstripbutton_click(object sender, eventargs e) { richtextboxex1.savefile("articles\\" + textbox1.text + ".dat", richtextboxstreamtype.richtext); file.setattributes("articles\\" + textbox1.text + ".dat", file.getattributes("articles\\" + textbox1.text + ".dat") | fileattributes.hidden); }
edit:
i think it's handle specific file.
msdn documentations:
the loadfile method not open file until handle created richtextbox. ensure control's handle created before calling loadfile method.
problem solved: program didn't let me overwrite files because having hidden attribute
once removed that, start working great.
thank help
Comments
Post a Comment