Advertisement

08.02.2007 at 07:50PM PDT, ID: 22739284
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

Can't access a class developed outside of native namespace

Asked by jvalescu in C# Programming Language

Tags: ,

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 = "192.168.254.54";

        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;
            try
            {
                KI2701Client.Connect(ip, port);
                KI2701Stream = KI2701Client.GetStream();
                if ((KI2701Stream.CanWrite && KI2701Stream.CanRead))
                {
                    connected = true;
                }
                else
                {
                    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);
                        break;
                    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);
                        break;
                }
            }
        }



        public static void disconnect()
        {
            if ((connected == true))
            {
                send("*rst");
                connected = false;
                KI2701Stream.Close();
                KI2701Client.Close();
                KI2701Client = null;
                dis = true;
            }
            connected = false;
        }

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

        public static void KIInput(ref string KIstatus)
        {
            send("SYST:FRSW?");
            KI2701Read(ref KIData);
            if ((KIData == "1"))
            {
                KIstatus = "Front";
            }
            else
            {
                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()
        {
            InitializeComponent();
        }

        #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;
        #endregion
        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!


Start Free Trial
 
Keywords: Can't access a class developed outsi…
 
Loading Advertisement...
 
[+][-]08.02.2007 at 08:29PM PDT, ID: 19622404

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.02.2007 at 08:39PM PDT, ID: 19622433

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 05:14AM PDT, ID: 19816899

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 05:36AM PDT, ID: 19816984

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Tags: access, namespace
Sign Up Now!
Solution Provided By: Yurich
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628