2

I created an application form which accesses tag's in another program. I used a dll to Access the tags IOM.InTouchDataAccess. I run the program, It works until I write a tag and press select. Error : Could not load file or assembly 'IOM.InTouchDataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. I'm still a novice programmer. The program stops in Program.cs at Application.Run(new InTouchTagBrowser());

Form code

public partial class InTouchTagBrowser : Form
    {
        public string tagName;

        public InTouchTagBrowser()
        {
            InitializeComponent();
        }

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

        private void SelectButton_Click(object sender, EventArgs e)
        {
            try
            {
                tagName = tagNameBox.Text;
                InTouchDdeWrapper inTouchWrapper = new InTouchDdeWrapper();
                string value = inTouchWrapper.Read(tagName);

                TagDotField tagDotField = new TagDotField(tagName);
                string description = inTouchWrapper.Read(tagDotField.Description);
                string engUnits = inTouchWrapper.Read(tagDotField.EngUnits);

                descriptionlbl.Text = description;
                englbl.Text = engUnits;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void WriteButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (tagName != "")
                {
                    MessageBox.Show("Please enter a tag!");
                }
                else
                {
                    string inputValue = ValueBox.Text;
                    InTouchDdeWrapper inTouchWrapperWriter = new InTouchDdeWrapper();

                    TagDotField tagWriter = new TagDotField(inputValue);
                    inTouchWrapperWriter.Write(tagName, inputValue);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                MessageBox.Show("Tag change successfull");
            }
        }
Conrad C
  • 746
  • 1
  • 11
  • 32
  • Sometimes can be the version of dll. Could you check if IOM.InTouchDataAccess has version 1.0.0.0? (Go to file in explorer and see properties) – Oscar Foley Oct 04 '12 at 18:20
  • 1
    at sounds like the dll you are trying to use requires another dll or file in order to work. You should ask who ever designed it (if it was made internally) what dlls need to be included with the dll you want to use. – Benjamin Danger Johnson Oct 04 '12 at 18:21
  • 1
    Please check http://stackoverflow.com/questions/9503429/filenotfoundexception-when-loading-dll – Alexei Levenkov Oct 04 '12 at 18:21
  • He says that this **is** the right dll . Also @cad , it is the right version – Conrad C Oct 04 '12 at 18:22
  • Did you already posted same question? http://stackoverflow.com/questions/12714806/dll-does-not-seem-to-be-read-why – Oscar Foley Oct 04 '12 at 18:31

1 Answers1

1

You are not giving much info. Here is a list of things I should try if I were you:

  1. Check if the file is in the hard disk. (Check \debug folder)
  2. If the file exists, double check that its version is 1.0.0.0
  3. Check that CopyLocal is true.
  4. Check that the dll IOM.InTouchDataAccess do not need other dlls. If it is part of a library you install, get sure all dlls are there. If not sure, user .NET Reflector to inspect its dependencies.
Oscar Foley
  • 6,817
  • 8
  • 57
  • 90
  • Did all first 3 and they are all OK. Ill check the 4th one know. I did not know that I didnt provide enought info. Sorry im still a beginner. – Conrad C Oct 04 '12 at 18:26