Dll does not seem to be read, why?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 07:55:12

问题


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", "");
        }

回答1:


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.



来源:https://stackoverflow.com/questions/12714806/dll-does-not-seem-to-be-read-why

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!