1

I have two projects in my solution called ePad demo and PLHardwareHelper. I have added a reference to the PLHardwareHelper for the epad demo and I can successfully access methods in epad from hardwarehelper.

The problem is though that I cannot access anything in hardware helper from epad. I can't added a reference because it says it will result in a circular reference. I can't even add the namespace as a reference in the form.

How can access methods in hardwarehelper from within epad without adding a reference?

I have added a third reference called ApplicationJoin so I can add it's reference to both the other projects but it still complains that it can't find it. I have added an image below to demonstrate:

solution

The code from ApplicationJoin:

namespace ApplicationJoin
{
    public partial class Form1 : Form
    {
        public static string _imagevalues = "";
        public Form1()
        {
            InitializeComponent();
        }

        public static void ImageValues(string value)
    {
        _imagevalues = value;
    }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

The issue:

theissue

The error on the blue squiggly line is:

The name 'ApplicationJoin' does not exist in the current context

I have tried rebuilding and cleaning the solution but it still doesn't work.

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
connersz
  • 1,153
  • 3
  • 23
  • 64
  • this is a common mistake that people make can you perhaps show the class structure or heading or some small snippet that relates to your code.. it's very easy for one to get caught up in this `circle jerk` so to speak.. also too creating a 3rd project and referencing it that was is also another viable option – MethodMan Dec 17 '14 at 15:25
  • This error means that you reference ePad within PLHardwareHelper and PLHardwareHelper within ePad. Everything clear for me... – MakePeaceGreatAgain Dec 17 '14 at 15:30
  • @GrantWinney The problem is that when I added the reference for this to the two projects, it come up with a yellow !triangle and said it couldnt be found. – connersz Dec 17 '14 at 15:39
  • @GrantWinney that is current, also just now I manually browsed to the DLL. The exclamation mark removed itself from the reference but i still can't access it from inside the forms. – connersz Dec 17 '14 at 15:44
  • @GrantWinney I have added screenshots. It's a shame you closed the question off so quickly before my response because now it prevents others from providing a potential answer. – connersz Dec 17 '14 at 15:56
  • Looks like you're trying to access it as if it were static, instead of having an instance of `Form1`. The _method_ is static, but not the _class_ `Form1`. – DonBoitnott Dec 17 '14 at 16:05
  • @DonBoitnott According to the code `ImageValues` is a static method of `Form1` – Anthony Dec 17 '14 at 16:06
  • @GrantWinney the blue line is The name 'ApplicationJoin' does not exist in the current context – connersz Dec 17 '14 at 16:07
  • @DonBoitnott I can't even access the reference at the moment. – connersz Dec 17 '14 at 16:08
  • @GrantWinney All of them set to .net 4 but still causing a problem. – connersz Dec 17 '14 at 16:14
  • Are you running these from an odd location? Copying the files in a build step or something, where the EXE and referenced assembly are in different places? Make sure the referenced assembly is "copy local". – DonBoitnott Dec 17 '14 at 16:15
  • I suspect that you are not using the correct (full) namespace. Check the ApplicationJoin assembly. Look at the property of the ApplicationJoin project to confirm. – Justjyde Dec 17 '14 at 21:33

0 Answers0