找不到类型或命名空间名称“ReportPrintTool” [英] type or namespace name 'ReportPrintTool' could not be found

查看:302
本文介绍了找不到类型或命名空间名称“ReportPrintTool”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void button1_Click(object sender,EventArgs e){

XtraReport1 report = new XtraReport1();



using(ReportPrintTool printTool = new ReportPrintTool(report)){

//调用打印对话框。

printTool.PrintDialog();



//将报告发送到默认打印机。

printTool.Print();



//将报告发送给指定打印机。

printTool.Print(myPrinter);

}



在上面的代码中出错6找不到类型或命名空间名称'ReportPrintTool'(您是否缺少using指令或程序集引用?)



我必须做什么?



任何人都会纠正它。

解决方案

你的班级 ReportPrintTool 属于您忘记添加的程序集和/或命名空间d使用指令进入项目引用和/或使用进入代码。


< blockquote>在Visual Studio中使用添加引用添加对DevExpress.XtraPrinting.v14.1.dll(或任何版本)的引用



添加这些行到模块的顶部

 使用 DevExpress.XtraPrinting; 
使用 DevExpress.XtraReports.UI;
使用 DevExpress.XtraPrinting.Preview;


private void button1_Click(object sender, EventArgs e) {
XtraReport1 report = new XtraReport1();

using (ReportPrintTool printTool = new ReportPrintTool(report)) {
// Invoke the Print dialog.
printTool.PrintDialog();

// Send the report to the default printer.
printTool.Print();

// Send the report to the specified printer.
printTool.Print("myPrinter");
}

In the above code Error 6 The type or namespace name 'ReportPrintTool' could not be found (are you missing a using directive or an assembly reference?)

what i have to do in this?

Anyone rectify it.

解决方案

Your class ReportPrintTool that you are using is belong to an assembly and/or namespace that you forgot to added into your project references and/or into your code with using directive.


Use "Add Reference" in Visual Studio to add a reference to DevExpress.XtraPrinting.v14.1.dll (or whatever version you have)

Add these lines to the top of your module

using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Preview;


这篇关于找不到类型或命名空间名称“ReportPrintTool”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆