简体   繁体   中英

Dll does not seem to be read, why?

I am creating a application form to view/change a tag from a software called InTouch.

I added the dll as a reference and I would like to use the Read(string tagName ) fct in the IOM.InTouchDataAccess. VS does not see the fct Read when I write InTouchWrapper TagType = new read() . It only sees InTouchWrapper as I wrote in the code which gives me the error IOM.InTouchDataAccess.InTouchWrapper' does not contain a constructor that takes 0 arguments

I don't understand why is this happening. I am running the InTouch software while coding, maybe there is an access conflict with the software.

MyCode

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 IOM.InTouchDataAccess;

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

        private void TagBrowser_Load(object sender, EventArgs e)
        {
        }

        private void TagBox_TextChanged(object sender, EventArgs e)
        {
        }

        private void TypeBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            InTouchWrapper TagType = new InTouchWrapper();
        }

The dll

using System;
using System.Collections.Generic;
using System.Text;
using NDde.Client;

namespace IOM.InTouchDataAccess
{
    public class InTouchDdeWrapper : IDisposable
    {
        private int DDE_TIMEOUT = 60000;

        private DdeClient _ddeClient;

        public InTouchDdeWrapper()
        {
            _ddeClient = new DdeClient("View", "Tagname");
        }

        ~InTouchDdeWrapper()
        {
            Dispose();
        }

        public void Initialize()
        {
            _ddeClient.Connect();
        }

        public string Read(string tagName)
        {
            return _ddeClient.Request(tagName, DDE_TIMEOUT).Replace("\0", "");
        }

I'm putting this here in case somebody else would get the same problem:

Are you sure it's the correct dll you referenced? Try to open the exact referenced dll in a decompiler ( JustDecompile free , Reflector or dotPeek free ) and see if it's the code you expect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM