i used a read stream to read an rtf file how开发者_运维技巧ever it failed when this rtf file is opened by Microsoft word.
is there anyone know how to solve this problem?
The proper way to read a RTF file for a rich text box (has to be of type System.Windows.Forms.RichTextBox) is like this:
myRichTextBox.LoadFile(myFilename);
But, because you have a lock on the file, you have to do it this way (credit to @slaks):
myRichTextBox.LoadFile(new FileStream(myFilename, FileAccess.Read, FileSharing.ReadWrite));
And to save it, simply call this function:
myRichTextBox.SaveFile(myFilename);
Like this:
new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论