2

I've installed the Okuma THINC_API. To use it in my program I know I need to put "Dim objMachine As Okuma.CMDATAPI.DataAPI.CMachine" somewhere. Does it go up at the top with the 'using' directives? Or does it need to be inside my namespace?

BradleyDotNET
  • 60,462
  • 10
  • 96
  • 117
Scott Solmer
  • 3,871
  • 6
  • 44
  • 72

1 Answers1

1

Short answer: Inside your namespace

There should be an example in the help file in the "Getting Started" section. The template I start from (in C#) is:

using Okuma.CMDATAPI;
using Okuma.CMCMDAPI;

namespace BasicAPIReferenceApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Okuma.CMDATAPI.DataAPI.CMachine objMachine;
            Okuma.CMDATAPI.DataAPI.CVariables objVariables;

            // Create an instance of CMachine class
            objMachine = new Okuma.CMDATAPI.DataAPI.CMachine();

            //Call the Init method of CMachine class to initialize the library once for the entire application.
            objMachine.Init();
            MessageBox.Show(
                System.Enum.GetNames(typeof(Okuma.CMDATAPI.Enumerations.OperationModeEnum)).
                GetValue((int)objMachine.GetOperationMode()).
                ToString());

            // Create other classes in the library for your need.
            objVariables = new Okuma.CMDATAPI.DataAPI.CVariables();

            // Set common variable 1 to value 10;
            objVariables.SetCommonVariableValue(1, 10);

            // When your application exits (finalize, onClose(), etc) you must
            //  release the connections to the thinc api using the following code:
            objMachine.Close();
        }
    }
}
AppFzx
  • 1,445
  • 2
  • 14
  • 23
  • I'm doing the same thing but I'm getting the following exception: System.ApplicationException: E01000175011 Failed to Failed to load Logging Servi ce - ApiLog1.3-initConnection: Failed to locate database file at D:\Program File s\Okuma\LoggingService\log.fdb. Any help would be appreciated! – Maha Benabbou Apr 04 '17 at 12:40