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:

  1. permissions current user granted
  2. 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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -