I am writing a DLL (DLL1) that is wrapping another DLL (DLL2). I need to
extract the information returned from DLL2 and pass it out to the Client
application this is using DLL1.
DLL2 returns data that I would like to return through DLL1 as a collection
so the user can use foreach (lookup li in _myAdapter.lookupInfoCol) and get
the li.JID and li.MailAddr1 data from the returned collection.
The data is in the collection and I think it is getting returned to the Client.
But I am getting a messages:
1. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(25):
'myConsoleNS.myConsole._myAdapter' denotes a 'field' where a 'class' was
expected
and
2. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(26):
The type or namespace name 'lookup' could not be found (are you missing a
using directive or an assembly reference?)
Any and all helps is extremely appreciated.
Thanks in advance,
rich
when trying to compile. Below is the code.
-> JSIAccessAdapter.cs
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
using System.IO;
using System.Collections;
namespace JPNGDNAPI
{
/// <summary>
/// JSIAccessAdapter is the base for the Jury Systems, inc wrapper..
/// </summary>
public class JSIAccessAdapter
{
// strings for communication with cobol dll
private string _ctlArea;
private string _reqArea;
private string _commArea;
// Declare the Classes for access.
private LookupInfo _LookupInfo;
private LookupInfoCol _LookupInfoCol;
public JSIAccessAdapter()
{
}
public LookupInfoCol GetJurorLookup(string LastName, string FirstName,
string DOB)
{
string spaces = new String(' ', 100);
StringBuilder sb = new StringBuilder(213, 213);
// Set up the Ctl Area.
sb.Append("00000000000000000000000000000");
sb.Append(spaces);
_ctlArea = sb.ToString();
StringBuilder sbReq = new StringBuilder(43, 43);
sbReq.Append(LastName);
sbReq.Append(FirstName);
sbReq.Append(DOB);
_reqArea = sbReq.ToString();
_commArea = new String(' ', 4096);
// CallCobolRoutine(_commArea, _ctlArea, _reqArea);
// Instantiate the identityInfo class with the CommArea
// This will extract CommArea into the individual fields.
LookupInfoCol lookupInfoCol = new LookupInfoCol(_commArea);
return lookupInfoCol;
}
public LookupInfo lookupInfo
{
get
{
return _LookupInfo;
}
set
{
_LookupInfo = value;
}
}
public LookupInfoCol lookupInfoCol
{
get
{
return _LookupInfoCol;
}
set
{
_LookupInfoCol = value;
}
}
}
}
-> LookupInfo.cs
using System;
namespace JPNGDNAPI
{
/// <summary>
/// Summary description for LookupInfo.
/// </summary>
public class LookupInfo
{
private string _JID ;
private string _MailAddr1 ;
// // Constructor
// public LookupInfo()
// {
// }
//
// public LookupInfo(string JID, string MailAddr1)
// {
// this.JID = JID;
// this.MailAddr1 = MailAddr1;
// }
public string JID
{
get
{
return _JID;
}
set
{
_JID = value;
}
}
public string MailAddr1
{
get
{
return _MailAddr1;
}
set
{
_MailAddr1 = value;
}
}
}
}
->LookupInfoCol.cs
using System;
using System.Collections;
namespace JPNGDNAPI
{
/// <summary>
/// Summary description for LookupInfo.
/// </summary>
public class LookupInfoCol : ArrayList
{
const int C_MaxInfoItems = 15;
private ArrayList _LookupInfoCollection = new ArrayList();
private LookupInfo _LookupInfo = new LookupInfo();
// Constructor
public LookupInfoCol(String commArea)
{
ExtractLookupInfo(commArea);
}
private void ExtractLookupInfo(string commArea)
{
int j = 0; // JID - Starting Location in Comm Area
int k = 135; // Mail Address 1 - Starting Location in Comm Area
for (int i = 0; i < C_MaxInfoItems; i++)
{
if(commArea.Substring(j, 9) != "000000000")
{
lookupInfo = new LookupInfo();
_LookupInfo.JID = commArea.Substring(j, 9);
_LookupInfo.MailAddr1 = commArea.Substring(k, 30);
// LookupInfo lookupInfo = new LookupInfo(commArea.Substring(j, 9),
commArea.Substring(k, 30));
j += 9;
k += 30;
_LookupInfoCollection.Add(lookupInfo);
}
}
}
public LookupInfo lookupInfo
{
get
{
return _LookupInfo;
}
set
{
_LookupInfo = value;
}
}
}
}
-> MyConsole.cs - Client Console App.
using System;
using JPNGDNAPI;
namespace myConsoleNS
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class myConsole
{
private JSIAccessAdapter _myAdapter = new JSIAccessAdapter();
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// Get access to the .Net Adapter
JSIAccessAdapter _myAdapter = new JSIAccessAdapter();
_myAdapter.lookupInfoCol = _myAdapter.GetJurorLookup("Hartquist", "Barbara",
"19411111");
-----------------------------> Message 1 appears for this line below.
_myAdapter.lookupInfoCol.lookupInfo lookup = _myAdapter.lookupInfo();
-----------------------------> Message 2 appears for the line below. Because
the line above is failing.
foreach (lookup li in _myAdapter.lookupInfoCol)
{
Console.WriteLine("JID = " + li.JID);
Console.WriteLine("JID = " + li.MailAddr1);
}
}
}
} 7 1313
Hi rbeyea, 1. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(25): 'myConsoleNS.myConsole._myAdapter' denotes a 'field' where a 'class' was
I believe is because in your Main method you have the following line:
_myAdapter.lookupInfoCol.lookupInfo lookup = _myAdapter.lookupInfo();
You are trying to declare an object, but instead of declaring it of type
LookupInfo (take notice of your capitalization) you have tried to use a field
in the object called lookupinfo. What you should have said is:
JPNGDNAPI.LookupInfo lookup = _myAdapter.lookupInfo;
notice that it is _myAdapter.lookupInfo because it is a property not
_myAdapter.lookupInfo() which it would be if that was a method.
Hope that helps
Mark R Dawson http://www.markdawson.org
"rbeyea" wrote:
I am writing a DLL (DLL1) that is wrapping another DLL (DLL2). I need to extract the information returned from DLL2 and pass it out to the Client application this is using DLL1.
DLL2 returns data that I would like to return through DLL1 as a collection so the user can use foreach (lookup li in _myAdapter.lookupInfoCol) and get the li.JID and li.MailAddr1 data from the returned collection.
The data is in the collection and I think it is getting returned to the Client. But I am getting a messages: 1. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(25): 'myConsoleNS.myConsole._myAdapter' denotes a 'field' where a 'class' was expected and 2. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(26): The type or namespace name 'lookup' could not be found (are you missing a using directive or an assembly reference?)
Any and all helps is extremely appreciated. Thanks in advance, rich
when trying to compile. Below is the code.
-> JSIAccessAdapter.cs
using System; using System.Text; using System.Runtime.InteropServices; using System.Reflection; using System.IO; using System.Collections;
namespace JPNGDNAPI {
/// <summary> /// JSIAccessAdapter is the base for the Jury Systems, inc wrapper.. /// </summary> public class JSIAccessAdapter {
// strings for communication with cobol dll private string _ctlArea; private string _reqArea; private string _commArea;
// Declare the Classes for access. private LookupInfo _LookupInfo; private LookupInfoCol _LookupInfoCol;
public JSIAccessAdapter() {
}
public LookupInfoCol GetJurorLookup(string LastName, string FirstName, string DOB) {
string spaces = new String(' ', 100); StringBuilder sb = new StringBuilder(213, 213);
// Set up the Ctl Area. sb.Append("00000000000000000000000000000"); sb.Append(spaces); _ctlArea = sb.ToString();
StringBuilder sbReq = new StringBuilder(43, 43);
sbReq.Append(LastName); sbReq.Append(FirstName); sbReq.Append(DOB);
_reqArea = sbReq.ToString();
_commArea = new String(' ', 4096);
// CallCobolRoutine(_commArea, _ctlArea, _reqArea);
// Instantiate the identityInfo class with the CommArea // This will extract CommArea into the individual fields. LookupInfoCol lookupInfoCol = new LookupInfoCol(_commArea);
return lookupInfoCol;
}
public LookupInfo lookupInfo { get { return _LookupInfo; } set { _LookupInfo = value; } }
public LookupInfoCol lookupInfoCol { get { return _LookupInfoCol; } set { _LookupInfoCol = value; } } } }
-> LookupInfo.cs
using System;
namespace JPNGDNAPI { /// <summary> /// Summary description for LookupInfo. /// </summary> public class LookupInfo {
private string _JID ; private string _MailAddr1 ;
// // Constructor // public LookupInfo() // { // } // // public LookupInfo(string JID, string MailAddr1) // { // this.JID = JID; // this.MailAddr1 = MailAddr1; // }
public string JID { get { return _JID; } set { _JID = value; } }
public string MailAddr1 { get { return _MailAddr1; } set { _MailAddr1 = value; } }
} }
->LookupInfoCol.cs
using System; using System.Collections;
namespace JPNGDNAPI { /// <summary> /// Summary description for LookupInfo. /// </summary> public class LookupInfoCol : ArrayList {
const int C_MaxInfoItems = 15;
private ArrayList _LookupInfoCollection = new ArrayList();
private LookupInfo _LookupInfo = new LookupInfo();
// Constructor public LookupInfoCol(String commArea) { ExtractLookupInfo(commArea); }
private void ExtractLookupInfo(string commArea) {
int j = 0; // JID - Starting Location in Comm Area int k = 135; // Mail Address 1 - Starting Location in Comm Area for (int i = 0; i < C_MaxInfoItems; i++) { if(commArea.Substring(j, 9) != "000000000") { lookupInfo = new LookupInfo();
_LookupInfo.JID = commArea.Substring(j, 9); _LookupInfo.MailAddr1 = commArea.Substring(k, 30);
// LookupInfo lookupInfo = new LookupInfo(commArea.Substring(j, 9), commArea.Substring(k, 30)); j += 9; k += 30;
_LookupInfoCollection.Add(lookupInfo); }
}
}
public LookupInfo lookupInfo {
get { return _LookupInfo; } set { _LookupInfo = value; } }
} }
-> MyConsole.cs - Client Console App.
using System; using JPNGDNAPI;
namespace myConsoleNS { /// <summary> /// Summary description for Class1. /// </summary> class myConsole {
private JSIAccessAdapter _myAdapter = new JSIAccessAdapter();
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { // Get access to the .Net Adapter JSIAccessAdapter _myAdapter = new JSIAccessAdapter(); _myAdapter.lookupInfoCol = _myAdapter.GetJurorLookup("Hartquist", "Barbara", "19411111");
-----------------------------> Message 1 appears for this line below. _myAdapter.lookupInfoCol.lookupInfo lookup = _myAdapter.lookupInfo();
-----------------------------> Message 2 appears for the line below. Because the line above is failing. foreach (lookup li in _myAdapter.lookupInfoCol) { Console.WriteLine("JID = " + li.JID); Console.WriteLine("JID = " + li.MailAddr1); }
} } }
Hello Mark,
Thanks! I did as you suggested and did not get message 1 again. But when
I try to reference lookup in a Foreach I get:
C:\Develop\CSharp\JuryWrapper\JPNGDNAPI\WindowsApp lication1\JPNGDNAPIClient.cs(575):
The type or namespace name 'lookup' could not be found (are you missing a
using directive or an assembly reference?)
It seems like it is out of scope. But I don't understand what it is doing.
// I have a using for JPNGDNAPI so
it is not needed below.
LookupInfo lookup = _myAdapter.lookupInfo;
// "lookup" gets squigled and gets
the above error message.
foreach (lookup li in _myAdapter.lookupInfoCol)
{
lbOutput.Items.Add("JID = " + li.JID);
}
What is really weird is if I try to reference "lookup" it has a JID property
(which i would expect). I must be missing something completely obvious!
Thanks in advance!
rich Hi rbeyea,
1. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(25 ): 'myConsoleNS.myConsole._myAdapter' denotes a 'field' where a 'class' was I believe is because in your Main method you have the following line:
_myAdapter.lookupInfoCol.lookupInfo lookup = _myAdapter.lookupInfo();
You are trying to declare an object, but instead of declaring it of type LookupInfo (take notice of your capitalization) you have tried to use a field in the object called lookupinfo. What you should have said is:
JPNGDNAPI.LookupInfo lookup = _myAdapter.lookupInfo;
notice that it is _myAdapter.lookupInfo because it is a property not _myAdapter.lookupInfo() which it would be if that was a method.
Hope that helps Mark R Dawson http://www.markdawson.org "rbeyea" wrote:
I am writing a DLL (DLL1) that is wrapping another DLL (DLL2). I need to extract the information returned from DLL2 and pass it out to the Client application this is using DLL1.
DLL2 returns data that I would like to return through DLL1 as a collection so the user can use foreach (lookup li in _myAdapter.lookupInfoCol) and get the li.JID and li.MailAddr1 data from the returned collection.
The data is in the collection and I think it is getting returned to the Client. But I am getting a messages: 1. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(25 ): 'myConsoleNS.myConsole._myAdapter' denotes a 'field' where a 'class' was expected and 2. C:\Develop\CSharp\TestJuryWrapper\JPNGDNAPI\myCons ole\myConsole.cs(26 ): The type or namespace name 'lookup' could not be found (are you missing a using directive or an assembly reference?) Any and all helps is extremely appreciated. Thanks in advance, rich when trying to compile. Below is the code.
-> JSIAccessAdapter.cs
using System; using System.Text; using System.Runtime.InteropServices; using System.Reflection; using System.IO; using System.Collections; namespace JPNGDNAPI { /// <summary> /// JSIAccessAdapter is the base for the Jury Systems, inc wrapper.. /// </summary> public class JSIAccessAdapter { // strings for communication with cobol dll private string _ctlArea; private string _reqArea; private string _commArea; // Declare the Classes for access. private LookupInfo _LookupInfo; private LookupInfoCol _LookupInfoCol; public JSIAccessAdapter() { }
public LookupInfoCol GetJurorLookup(string LastName, string FirstName, string DOB) { string spaces = new String(' ', 100); StringBuilder sb = new StringBuilder(213, 213); // Set up the Ctl Area. sb.Append("00000000000000000000000000000"); sb.Append(spaces); _ctlArea = sb.ToString(); StringBuilder sbReq = new StringBuilder(43, 43);
sbReq.Append(LastName); sbReq.Append(FirstName); sbReq.Append(DOB); _reqArea = sbReq.ToString();
_commArea = new String(' ', 4096);
// CallCobolRoutine(_commArea, _ctlArea, _reqArea);
// Instantiate the identityInfo class with the CommArea // This will extract CommArea into the individual fields. LookupInfoCol lookupInfoCol = new LookupInfoCol(_commArea);
return lookupInfoCol;
}
public LookupInfo lookupInfo { get { return _LookupInfo; } set { _LookupInfo = value; } } public LookupInfoCol lookupInfoCol { get { return _LookupInfoCol; } set { _LookupInfoCol = value; } } } } -> LookupInfo.cs
using System;
namespace JPNGDNAPI { /// <summary> /// Summary description for LookupInfo. /// </summary> public class LookupInfo { private string _JID ; private string _MailAddr1 ; // // Constructor // public LookupInfo() // { // } // // public LookupInfo(string JID, string MailAddr1) // { // this.JID = JID; // this.MailAddr1 = MailAddr1; // } public string JID { get { return _JID; } set { _JID = value; } } public string MailAddr1 { get { return _MailAddr1; } set { _MailAddr1 = value; } } } } ->LookupInfoCol.cs
using System; using System.Collections; namespace JPNGDNAPI { /// <summary> /// Summary description for LookupInfo. /// </summary> public class LookupInfoCol : ArrayList { const int C_MaxInfoItems = 15;
private ArrayList _LookupInfoCollection = new ArrayList();
private LookupInfo _LookupInfo = new LookupInfo();
// Constructor public LookupInfoCol(String commArea) { ExtractLookupInfo(commArea); } private void ExtractLookupInfo(string commArea) { int j = 0; // JID - Starting Location in Comm Area int k = 135; // Mail Address 1 - Starting Location in Comm Area for (int i = 0; i < C_MaxInfoItems; i++) { if(commArea.Substring(j, 9) != "000000000") { lookupInfo = new LookupInfo(); _LookupInfo.JID = commArea.Substring(j, 9); _LookupInfo.MailAddr1 = commArea.Substring(k, 30); // LookupInfo lookupInfo = new LookupInfo(commArea.Substring(j, 9), commArea.Substring(k, 30)); j += 9; k += 30; _LookupInfoCollection.Add(lookupInfo); } }
}
public LookupInfo lookupInfo { get { return _LookupInfo; } set { _LookupInfo = value; } } } } -> MyConsole.cs - Client Console App.
using System; using JPNGDNAPI; namespace myConsoleNS { /// <summary> /// Summary description for Class1. /// </summary> class myConsole { private JSIAccessAdapter _myAdapter = new JSIAccessAdapter();
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { // Get access to the .Net Adapter JSIAccessAdapter _myAdapter = new JSIAccessAdapter(); _myAdapter.lookupInfoCol = _myAdapter.GetJurorLookup("Hartquist", "Barbara", "19411111");
-----------------------------> Message 1 appears for this line below. _myAdapter.lookupInfoCol.lookupInfo lookup = _myAdapter.lookupInfo();
-----------------------------> Message 2 appears for the line below. Because the line above is failing. foreach (lookup li in _myAdapter.lookupInfoCol) { Console.WriteLine("JID = " + li.JID); Console.WriteLine("JID = " + li.MailAddr1); } } } }
rbeyea <rb****@softstufsoftware.com> wrote: Thanks! I did as you suggested and did not get message 1 again. But when I try to reference lookup in a Foreach I get: C:\Develop\CSharp\JuryWrapper\JPNGDNAPI\WindowsApp lication1\JPNGDNAPIClient.cs(575): The type or namespace name 'lookup' could not be found (are you missing a using directive or an assembly reference?)
It seems like it is out of scope. But I don't understand what it is doing.
// I have a using for JPNGDNAPI so it is not needed below. LookupInfo lookup = _myAdapter.lookupInfo;
// "lookup" gets squigled and gets the above error message. foreach (lookup li in _myAdapter.lookupInfoCol) { lbOutput.Items.Add("JID = " + li.JID); }
What is really weird is if I try to reference "lookup" it has a JID property (which i would expect). I must be missing something completely obvious!
You're trying to declare li to be a variable of type "lookup" - you
actually want it to be of type "LookupInfo":
foreach (LookupInfo li in _myAdapter.lookupInfoCol)
{
...
}
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Also, _myAdapter has to be static.
Hello Jon Skeet [C# MVP],
Thanks! Worked perfect. I thought I had tried that.
Thanks again! rbeyea <rb****@softstufsoftware.com> wrote:
Thanks! I did as you suggested and did not get message 1 again. But when I try to reference lookup in a Foreach I get: C:\Develop\CSharp\JuryWrapper\JPNGDNAPI\WindowsApp lication1\JPNGDNAPI Client.cs(575): The type or namespace name 'lookup' could not be found (are you missing a using directive or an assembly reference?) It seems like it is out of scope. But I don't understand what it is doing.
// I have a using for JPNGDNAPI so it is not needed below. LookupInfo lookup = _myAdapter.lookupInfo; // "lookup" gets squigled and gets the above error message. foreach (lookup li in _myAdapter.lookupInfoCol) { lbOutput.Items.Add("JID = " + li.JID); } What is really weird is if I try to reference "lookup" it has a JID property (which i would expect). I must be missing something completely obvious! You're trying to declare li to be a variable of type "lookup" - you actually want it to be of type "LookupInfo":
foreach (LookupInfo li in _myAdapter.lookupInfoCol) { ... }
Hello jn*********@gmail.com,
Thanks! it worked without being static. But I under stand why it should be
set this way!
Thanks again,
rich Also, _myAdapter has to be static.
<jn*********@gmail.com> wrote: Also, _myAdapter has to be static.
No it doesn't - it's a local variable, at least in the first post.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lee Mundie |
last post by:
Hi there,
Simple problem here but can't seem to fix it!
Okay, I have a select list from which people choose avatars...
the list is option values ie. <option>Worm</option> ...
|
by: Lokkju |
last post by:
I am pretty much lost here - I am trying to create a managed c++
wrapper for this dll, so that I can use it from c#/vb.net, however, it
does not conform to any standard style of coding I have seen....
|
by: jsale |
last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app
i have made is running on IIS v6 and consists of a number of pages that allow
the user to read information from the...
|
by: Michael |
last post by:
Dear All :
I have a problem about define property GridTableStylesCollection in
usercontrol.
The code show as follow :
Public Property StylesCollector() As GridTableStylesCollection
Set(ByVal...
|
by: Michael |
last post by:
Thanks for your advice.
However, I have copy your script into test my project
The code is that :
Imports System.Windows.Forms
Public Class MilesBox
Inherits System.Windows.Forms.UserControl...
|
by: Stacey Levine |
last post by:
I have a webservice that I wanted to return an ArrayList..Well the service
compiles and runs when I have the output defined as ArrayList, but the WSDL
defines the output as an Object so I was...
|
by: Matt Kemmerer |
last post by:
I'm trying to return a HashTable froma WebMethod. This fails with a not
supported method because HashTable implements IDictionary. What I'm doing
right now instead is stuffing my data into a...
|
by: Mousam |
last post by:
Hi All,
First of all forgive me for the length of this post.
I am developing one library for some text editor. In this library
I want to provide a set of C++ classes which will enable client (of...
|
by: PeterAPIIT |
last post by:
Hello all C++ expert programmer,
i have wrote partial general allocator for my container.
After reading standard C++ library and code guru article, i have
several questions.
1. Why...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |