"An unhandled exception of type 'System.NullReferenceException' occurred in
system.windows.forms.dll
Additional information: Object reference not set to an instance of an
object."
Other than that, my problem remains the same as stated below.
---------------------------
Dave,
Can you create a new instance of recordset and then populate it by method
call?
e.g.,
private ADODB.Recordset rsFBillData = new ADODB.Recordset();
rsFBillData = oFBE.GetFBillData("482-389548-9");
If this does not work, then post your question again in
<microsoft.public.dotnet.framework.interop> thread.
Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
---------------------------
A team at work has developed a VB 6.0 COM+ object that has a few rather
complex methods that I could use for my current project. Rather than
reinvent the wheel, I want to make a few method calls to their object from
.NET / C#. So I registered their object on my box with no problems. I tried
a test from VB 6.0, making a reference, then calling a method that I'm
interested in. It all worked great.
Then in .NET, I make a reference to this object too. I also reference ADODB
v2.7. Intellisense shows the properties, methods, ect... as I would expect.
Here's a code snippet that I wrote in C#:
----
fbeBusServerDotNet.clsFBEApplication oFBE = new
fbeBusServerDotNet.clsFBEApplicationClass();
ADODB.Recordset rsFBillData = oFBE.GetFBillData("482-389548-9");
if(!rsFBillData.EOF)
{
// do stuff
}
----
Now the problem. I can't access rsFBillData, the ADODB.Recordset. In
debugging, oFBE is instantiated and the method call succeeds. At this point
everything seems fine. A "Quick Watch" shows that rsFBillData contains the
values that I would expect, like RecordCount=1, EOF=false, ect... However,
the code fails at rsFBillData.EOF, complaining that "An unhandled exception
of type 'System.ExecutionEngineException' occurred in ...". In the
"Immediate Window", I learn the following:
----
?rsFBillData.EOF
error: 'rsFBillData.EOF' does not exist
?rsFBillData
{ADODB.RecordsetClass}
[ADODB.RecordsetClass]: {ADODB.RecordsetClass}
?rsFBillData.RecordCount
error: 'rsFBillData.RecordCount' does not exist
----
The errors contradict what "Quick Watch" is showing me. According to "Quick
Watch", the properties EOF and RecordCount have values of 'false' and '1'.
How can I get this working?
tlbimp "C:\PROJECTS\Freight Billing Entry\Working
Version\Release\Server\!fbeBusServer.dll" /out:"C:\PROJECTS\Freight Billing
Entry\Working Version\Release\Server\fbeBusServerDotNet.dll"
/keyfile:"C:\PROJECTS\PROCONTROL&CITYDISPATCH\Bin\ctii.snk"
Then we reference fbeBusServerDotNet.dll in .NET, and get the below results.
Note that !fbeBusServer.dll is the VB 6.0 COM+ object.
However, I created a test project that doesn't use a key, so I simply
referenced the VB 6.0 COM+ object directly. It works!
Then I used the TLBIMP command without referencing the keyfile (the test
project is not signed). The generated DLL fails just as listed below.
So how can I get TLBIMP to work so I can use this DLL signed?
"Dave" <nos...@yahoo.com> wrote in message
news:e9C4bLqdCHA.2524@tkmsftngp10...
For C# projects, this is easy to fix.
In your project where you have unsigned COM-DLL, go to Project Properteis
window.
Open Common Properties -> General section.
In this section, there is a field called "Wrapper Assembly Key File".
Provide the Key file name here and your InterOP DLL will be signed by VS
NET IDE.