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.TcpClie
nt KI2701Client = new System.Net.Sockets.TcpClie
nt();
public static System.Net.Sockets.Network
Stream 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.GetB
ytes(KIDat
a);
// 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.SocketE
xception errnum = new System.Net.Sockets.SocketE
xception()
;
// .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.ReceiveB
ufferSize]
;
KI2701Stream.Read(bytes, 0, KI2701Client.ReceiveBuffer
Size);
KIdata = System.Text.ASCIIEncoding.
ASCII.GetS
tring(byte
s);
// 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.T
ools;
using Dart.PowerTCP;
using global::Keithley2701ClassL
ib;
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.TextB
ox txtStatus;
private System.Windows.Forms.Label
label12;
private System.Windows.Forms.Label
label13;
private System.Windows.Forms.Label
label14;
private System.Windows.Forms.TextB
ox txtStartTime;
private System.Windows.Forms.TextB
ox txtElapsedTime;
private System.Windows.Forms.TextB
ox textBox4;
private System.Windows.Forms.Label
label15;
private System.Windows.Forms.Combo
Box cboPeakView;
private System.Windows.Forms.Butto
n btnStop;
private System.Windows.Forms.Butto
n btnStartExposure;
private System.Windows.Forms.Timer
timerGap;
//private System.ComponentModel.ICon
tainer 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.TextB
ox txt2701;
private System.Windows.Forms.TextB
ox 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.AppS
ettings["D
SN"];
public ArrayList arChamberInfo = new ArrayList();
public ArrayList arTimers = new ArrayList();
private global::Keithley2701ClassL
ib.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