Home » .Net FrameworkRSS

POS Printer Device Enabled - POSControlException Thrown

I'm attempting to print to an NCR 7197 receipt printer using the Microsoft.PointOfService dll that's part of Microsoft POS for .NET SDK.

Here are some of the resources I've examined:




The simplified C# 2008 code I'm working with is the following:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.PointOfService;

namespace MyOPOSPrinterTest
  public partial class frmPOSTest : Form
    PosExplorer posExplorer = new PosExplorer();
    string strLogicalName = "MyTestPrinter";

    public frmPOSTest()

    private void Form1_Load(object sender, EventArgs e)
      DeviceInfo oDevicePrinter = posExplorer.GetDevice("PosPrinter", strLogicalName);
      PosPrinter oPrinter = (PosPrinter)posExplorer.CreateInstance(oDevicePrinter);

        if (oPrinter != null)
          oPrinter.DeviceEnabled = true;
      catch (Exception exPrinter)
        MessageBox.Show(exPrinter.ToString(), "Warning");

I get a POSControlException on the following line:

oPrinter.DeviceEnabled = true;

Additional details on the exception:

"Microsoft.PointOfService.PosControlException: Failed to set property DeviceEnabled

at Microsoft.PointOfService.Legacy.LegacyProxy.SetProperty(String propertyName, Object propertyValue)

at Microsoft.PointOfService.Legacy.LegacyProxy.set_DeviceEnabled(Boolean value)

at Microsoft.PointOfService.Legacy.LegacyPosPrinter.set_DeviceEnabled(Boolean value)

at MyOPOSPrinterTest.frmPOSTest.Form1_Load(Object sender, EventArgs e) ...

ErrorCode: Failure

ErrorCodeExtended: 0

End of Additional Details

I'd appreciate some suggestions on what I might be missing.




1 Answer Found


Answer 1

I've also done quite a bit of searching on the MSDN Forums.

<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter