Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, Iam using VS2015 Winforms, VC++. C++/CLI With my application I try to print the rdlc report. And I get the below error.

can't take address of 'PrintRDLCReport::CreateStream' unless creating delegate instance.

	private: static Stream^ stream = gcnew MemoryStream();
		 
	public: static Stream^ CreateStream(String^ name, String^ fileNameExtension, Encoding^ encoding, String^ mimeType, bool willSeek){
		//Stream^ stream = gcnew MemoryStream();
		stream = gcnew MemoryStream();
		//stream = gcnew FileStream(name + "." + fileNameExtension,FileMode::Create);
		m_streams->Add(stream);
		return stream;
	}
	public: static System::Void Export(LocalReport^ report, bool print){
		PaperSize^ paperSize = m_pageSettings->PaperSize;
		Margins^ margins = m_pageSettings->Margins;
		print = true;
		
		String^ deviceInfo = String::Format(CultureInfo::InvariantCulture,
			"<DeviceInfo>" +
			"<OutputFormat>EMF</OutputFormat>" +
			"<PageWidth>{5}</PageWidth>" +
			"<PageHeight>{4}</PageHeight>" +
			"<MarginTop>{0}</MarginTop>" +
			"<MarginLeft>{1}</MarginLeft>" +
			"<MarginRight>{2}</MarginRight>" +
			"<MarginBottom>{3}</MarginBottom>" +
			"</DeviceInfo>",
			ToInches(margins->Top),
			ToInches(margins->Left),
			ToInches(margins->Right),
			ToInches(margins->Bottom),
			ToInches(paperSize->Height),
			ToInches(paperSize->Width));

		cli::array<Warning^>^ warnings;
		m_streams = gcnew List<Stream^>();
		

report->Render("Image", deviceInfo, CreateStream, warnings); ?????????????????????????

This above line CreateStream generates the error
can't take address of 'PrintRDLCReport::CreateStream' unless creating delegate instance	
 

		for each(Stream^ stream in m_streams) {
			stream->Position = 0;
		}
		if (print==true){
			Print();
		}
	}


Thanks for the kind advice, Thanks again !

What I have tried:

Try to print the RDLC report directly to the printer
Posted

1 solution

 
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