I am trying to read files opened by openFileDialog in a richTextBox (called websiteInput_rtxt) using backgroundworker (bgFileOpener).
private void bgFileOpener_DoWork(object sender, DoWorkEventArgs e) { try { foreach (var file in openFileDialog1.FileNames) { using (StreamReader sreader = new StreamReader(file)) {
When the form is closed while bgWorker is still running, an exception is thrown that doesn't seem to be caught , can someone tell me what is missing or what might throw an exception?
The exception message is called "System.Reflection.TargetInvocationException", and innerException says something about the RichTextBox.
user2695458
source share