Somebody please help me...
I printed first report properly, while printing second report (for eg sales bill) compiler shows an error message, "The process cannot access the file because it is being used by another process". The code is given below where the IOException was shown.

// Routine to provide to the report renderer, in order to
        //    save an image for each page of the report.
        private static Stream CreateStream(string name,
          string fileNameExtension, Encoding encoding,
          string mimeType, bool willSeek)
        {
            Stream stream;
            stream= new FileStream(name +
               "." + fileNameExtension, FileMode.Create);
            m_streams.Add(stream);
            return stream;
        }

Recommended Answers

All 2 Replies

Close the device or file before you leave CreateStream() method.

where is your actual printing functionality?
I think you should dispose file stream so that it release the working file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.