


I was also thinking of copy paste the foreach loop but only with the memory-writing parts. (What I wanted to do is this: store the values in the memory or somewhere (right after the generation) and when the user wants to export it is simply written to the file. Any recommendations for this code part is much appreciated. If I close the fileStream, later I can't access the memory stream because that's also closed. MessageBox.Show(String.Format(Strings.successfulSavedCSVFile, dlg.FileName)) Ĭould it cause any sort of disadvantages in memory efficiency? I'm thinking of, e.g., not closing the filestream or something. Using (FileStream file = new FileStream(dlg.FileName, FileMode.Create, FileAccess.Write))ītnExportCSV.Content = Strings.CSVExported On this tab there is a CSV Export button, click: SaveFileDialog dlg = new SaveFileDialog()įilter = "CSV comma separated values (.csv)|*.csv" Writer.Write(value = "-" ? " " : value + " ") Writer.WriteLine(value = "-" ? "" : value) (DateTime as key, and float as value, nothing special.) // Creating the rows.

Message'Object reference not set to an instance of an object. I get the following message: System.NullReferenceException was unhandled. object when its Close () method is called. When I click on the "Generate Chart" button, after the chart generator code has run, the following method is also invoked (that generates the table above): void FillGridDetails(List chartDataIn) For some odd reason, PdfStamper either closes or disposes my MemoryStream. My little program I'm working on generates charts (GUI) and (on another tab) lists the values my chart is fed from.
