Can't access a class developed outside of native namespace

Posted on 2007-08-02
Last Modified: 2008-01-09
OK, I've looked at this much too long and am only breaking it further.  I have a class I generated outside of my solution namespace.  I've add its project to my solution, I've add the reference .dll for the class as well.  I cannot "get" to the methods or properties defined within the class.  They are declared public, not sure what to do.........:

Class code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

//using System.Text.Encoding;

namespace Keithley2701ClassLib
    //class General

    public static class General

        // Version 1.1
        // EEB
        public const Int16 port = 1394;

        public static System.Net.Sockets.TcpClient KI2701Client = new System.Net.Sockets.TcpClient();

        public static System.Net.Sockets.NetworkStream KI2701Stream;

        public static string KIstatus;

        public static bool connected = false;

        public static string ip = "";

        public static byte[] KIByte;

        public static string KIData;

        public static bool front = false;

        private static bool dis = false;

        public static void send(string KIData)
            KI2701Stream = KI2701Client.GetStream();
            KIData = (KIData + "\r");
            //  Add control reset to the command line
            KIByte = System.Text.ASCIIEncoding.ASCII.GetBytes(KIData);
            //  Convert to byte
            KI2701Stream.Write(KIByte, 0, KIData.Length);
            //  Send data

        public static void connect(string ip)
            object zz;
            object z;
                KI2701Client.Connect(ip, port);
                KI2701Stream = KI2701Client.GetStream();
                if ((KI2701Stream.CanWrite && KI2701Stream.CanRead))
                    connected = true;
                    connected = false;
            catch (Exception e)
                System.Net.Sockets.SocketException errnum = new System.Net.Sockets.SocketException();
                // .ErrorCode()
                string aa;
                switch (errnum.ErrorCode)
                    case 10060:
                        MessageBox.Show("Could not connect to the 2701, please recheck your connections and network settings and try again ", "Time Out Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    case 10061:
                        MessageBox.Show("Could not open connection because instrument has an open connection to another application.  Close th" +
                             "e connected application or power cycle the instrument to close existing connection", "Connection Refused !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        MessageBox.Show(("Error has occured:  "
                              + (errnum.ErrorCode + ("  " + e.Message))), "Error has been detected !", MessageBoxButtons.OK, MessageBoxIcon.Error);

        public static void disconnect()
            if ((connected == true))
                connected = false;
                KI2701Client = null;
                dis = true;
            connected = false;

        public static void KI2701send(string data)
            // Send data
            byte senddata;

        public static void KIInput(ref string KIstatus)
            KI2701Read(ref KIData);
            if ((KIData == "1"))
                KIstatus = "Front";
                KIstatus = "Rear";

        public static void KI2701Read(ref string KIdata)
            //  Read network stream into byte buffer
            byte[] bytes = new byte[KI2701Client.ReceiveBufferSize];
            KI2701Stream.Read(bytes, 0, KI2701Client.ReceiveBufferSize);
            KIdata = System.Text.ASCIIEncoding.ASCII.GetString(bytes);
            //  Debug.WriteLine(KIdata)


<Snippets of calling form code>
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Dart.PowerTCP.Sockets;
using System.Diagnostics;
using System.Data;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;
using System.Threading;
using Syncfusion.Windows.Forms.Tools;
using Dart.PowerTCP;

using global::Keithley2701ClassLib;

namespace Inhallation
    public partial class frmVoltmeter : Form
        public frmVoltmeter()

        #region Windows Control stuff
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.TextBox txtStatus;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.TextBox txtStartTime;
        private System.Windows.Forms.TextBox txtElapsedTime;
        private System.Windows.Forms.TextBox textBox4;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.ComboBox cboPeakView;
        private System.Windows.Forms.Button btnStop;
        private System.Windows.Forms.Button btnStartExposure;
        private System.Windows.Forms.Timer timerGap;
        //private System.ComponentModel.IContainer components;
        public byte[] buffer = new byte[1024];
        public byte[] HPbuffer = new byte[1024];
        public byte[] DAQbuffer = new byte[1024];
        public bool HPInit = true;
        public bool DAQInit = true;
        //private Dart.PowerTCP.Sockets.Tcp tcpValve;
        //private Dart.PowerTCP.Sockets.Tcp tcpHP;
        private bool ValveConnected = false;
        private bool HPConnected = false;
        private bool DAQConnected = false;
        public int prevValvepos = 0;
        private Dart.PowerTCP.Sockets.Tcp tcp2701;
        private System.Windows.Forms.TextBox txt2701;
        private System.Windows.Forms.TextBox txtDisplay1;
        // private Dart.PowerTCP.Sockets.Tcp tcpValve;
        //private Dart.PowerTCP.Sockets.Tcp tcp2701;
        //private Dart.PowerTCP.Sockets.Tcp tcpHP;
        private System.Windows.Forms.Timer timer2701;
        private Dart.PowerTCP.Sockets.Tcp tcp2701Reset;
        string strConn = ConfigurationSettings.AppSettings["DSN"];
        public ArrayList arChamberInfo = new ArrayList();
        public ArrayList arTimers = new ArrayList();

        private global::Keithley2701ClassLib.Class1 K2701 = new Class1();

        If I try to access anything under K2701, I get the standard options, not the exposed methods,  What's wrong?  Thanks!

Question by:jvalescu
    LVL 21

    Expert Comment

    Are you sure you listed it in your postage correctly? There is no Class1 defined in the Keithley2701 namespace :( only General. Another point - you have everything static, you don't need to create an instance of the class in this case, just use class-scope, not instance-scope, e.g:

    Keithley2701ClassLib.send( "..." );

    and lastly, if you added this project to your project, why do you use global? just doing this:

    using Keithley2701ClassLib;


    should give you access to the namespace and enable intellisense for the class.
    LVL 19

    Expert Comment

    And remove the assembly reference if you have put the project into the main solution.  I don't know which one has precedence, but the assembly reference is not per configuration, so you can only reference the debug or release assembly and it will be for both configurations of the dependent project.

    LVL 21

    Accepted Solution

    I think an appropriate help was provided.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now