Click here to Skip to main content
15,922,574 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing an application in WPF. I want some *.html files to open in the rich text box.
I am getting the following error: Cannot access C drive.
I am using the following code.

richTextBox_LessonView.Document = new FlowDocument();
                TextRange documentTextRange = new TextRange(
                    richTextBox_LessonView.Document.ContentStart, richTextBox_LessonView.Document.ContentEnd);

                using (FileStream fs = File.Open(folderloc + display_lesson, FileMode.Open))

                    documentTextRange.Load(fs, System.Windows.DataFormats.Html);


can any body help on this..
Thanks..
Posted

1 solution

First, System.Windows.DataFormats.Html isn't currently supported so an exception will be thrown if the Open() call succeeds.

Otherwise, the issue sounds like the process not having sufficient permissions to access the file.
 
Share this answer
 

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