我正在开发一个应用程序,其中一个模块是收据打印。我已经为打印机编写了代码,但是当我执行程序时,在我的一个方法中得到了一个异常。这是我得到异常的代码。
打印机: 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"
}发布于 2014-02-28 14:59:09
看起来这一行DeviceInfo receiptPrinterDevice = posExplorer.GetDevice(DeviceType.PosPrinter, "MYPRINTER");返回的是一个空值。确保他的行实际上返回的是DeviceInfo。
https://stackoverflow.com/questions/22087905
复制相似问题