0
我正在开发一个应用程序,其中一个模块是收据打印。 我已经为打印机编码,但是当我执行程序时,在我的一个方法中出现异常。这里是我得到例外的代码。使用收据打印机
打印机:PMX热敏票据打印机 型号:PMX 80220
private PosPrinter GetReceiptPrinter()
{
PosExplorer posExplorer = new PosExplorer(this);
DeviceInfo receiptPrinterDevice = posExplorer.GetDevice(DeviceType.PosPrinter, "MYPRINTER");
return (PosPrinter)posExplorer.CreateInstance(receiptPrinterDevice); //Here I am getting an exception "ArgumentNullException"
}
做一个测试,看看如果receiptPrinterDevice == null,它可能不会使用posExplorer.GetDevice获取设备 – Shredder2500
确保“MYPRINTER”是“设备和打印机”中安装的打印机的实际名称 – user65439