[POS] Attempting to automatically open a cashdrawer - .net variable has not been instantianed

marcussulicmarcussulic Member Posts: 15
edited 2016-07-26 in NAV Three Tier
Hello Dynamics community!

My first steps into Nav 2016 and I'm getting an error.
I'm connecting a PC
HP RP7800 Retail System
with a cashdrawer
HP Standard Duty Cash Drawer (QT457AA)

I'm connecting the cashdrawer directly (without a receipt printer) and use a "RJ45 from drawer to RJ12 to the PC" cable.

POS Drivers from here and POS for .NET from here installed.

In the both packs there are test tools with which I succeed at opening the cashdrawer automatically.
The tools look somewhat like this on the 8 site from this PDF from the OPOS drivers pack

I have referenced a few DLLs from the .NET for POS Pack and activated the RunOnClient property on them.
My code in NAV
//PosDevice := PosExplorer.PosExplorer;
// PosDevice.
// PosDrawer.OpenDrawer();
// PoSDrawer := PoSDrawer.OpenDrawer();
//PosExplorer. OpenDrawer();

 KassenFunktionen := KassenKlasse.OPOSCashDrawerClass;
 KassenFunktionen.DeviceEnabled := TRUE;

PosDeviceCollection := PosExplorer.GetDevices('CashDrawer');
PosDeviceInfo := PosDeviceCollection.Item(1);

 PosDeviceInfo := PosExplorer.GetDevice('CashDrawer','HP_CashDrawerPort-1');
  check := PosDeviceInfo.IsDefault;

 PosCommon := PosExplorer.CreateInstance(PosDeviceInfo);

 PoSDrawer.DeviceEnabled := TRUE;
 PoSDrawer.DeviceEnabled := FALSE;

//CashDrawer.DeviceEnabled := TRUE;
//CashDrawer.DeviceEnabled := FALSE;

I just need a piece of code that opens the cashdrawer, the info checks etc arent essential.
Sorry, that there are too many comments. I copied the code as fast as I could and replicated some of it from memory. Didn't want to delete the wrong ones because I'm a newbie. No matter what I tried to change with the code it showed me errors.

The error looks like this:)
I really have no idea
This doesnt help

I will try to answer everything as soon as I get to the code again.
Thanks in advance for the time wasted on me.


  • Options
    archer89archer89 Member Posts: 337
    TextToSpeech is not part of your code. did you miss something?
    KassenFunktionen := KassenKlasse.OPOSCashDrawerClass; seems not to be a ..net class, maybe an automation call.
    i such cases, i always develope the .net part of the code in visual studio (express), to test the part if it works in general.
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • Options
    marcussulicmarcussulic Member Posts: 15
    edited 2016-07-26
    Sorry, I should have specified that it's not my error, buta similiar error found on the Internet.
    Here's mine:
    It says "an instance of the following .NET variable could not be created, so I assumed it's the same as the error posted before, despite different wording.

    These are my locals from the drivers that I've installed:

    Sorry I don't really understand the concept it being an Automation call and not a class. I'll try to find some info on that.
    Meanwhile I'm quickly posting these screenshots to clear out some things.
    Using Win10 by the way.

    Thanks for the fast respond.
  • Options
    lhlDKlhlDK Member Posts: 11
    edited 2016-07-26
    My guess is that you only have copied your .net class into the client-addins and have declared the variable to run on the server.
  • Options
    marcussulicmarcussulic Member Posts: 15
    By copying, do you mean setting local variables or manually copying. The only thing I did was setting the Locals using DLLs that were installed with POS for .NET 1.14. They were put into GAC not by me but by the installer. Im just referencing them in NAV. Or at least I hope.
    Isn't it enough? I don't quite understand the distinction of Client and Server yet so sorry

  • Options
    lhlDKlhlDK Member Posts: 11
    edited 2016-07-27
    EDIT: I just read further up in the thread that you already did this so this is not helping then :-(
    If the .net dll's is gac'ed then i think you have to define the locals to run on the client:
    (Example using my own stuff)
    Click on the variable and show properties:

    Change 'RunOnClient to 'Yes':

Sign In or Register to comment.